linux 下virtualenv及TensorFlow环境搭建与安装
来源:互联网 发布:织带打版软件 编辑:程序博客网 时间:2024/06/07 22:43
虚拟环境—virtualenv
我理解的虚拟环境就像是出租屋的房东,房东会提供一些基本配置,但是如果你有啥个性化需求请自行配置(话说我想买个遮阳的窗帘儿,一切都准备好了,就差资金了)。
python里的virtualenv就有这样的功效,它解决了项目A需要依赖2.Xpython,而项目B需要依赖3.Xpython这种两难问题,从而使你的全局site-package目录保持干净和可管理。
virtualenv安装
重点终于来了,本文以linux系统为例简单介绍virtualenv通过pip安装virtualenv
# pip install virtualenv
gjh@gjh-System-Product-Name:~$ pip install virtualenv
Collecting virtualenv
Downloading virtualenv-15.1.0-py2.py3-none-any.whl (1.8MB)
100% |████████████████████████████████| 1.8MB 42kB/s
Installing collected packages: virtualenv
如果你的机子是共用的,而你的权限又不够大可是尝试下面的语句
$ pip install virtualenv --user
gjh@gjh-System-Product-Name:~$ pip install virtualenv --user
Collecting virtualenv
Using cached virtualenv-15.1.0-py2.py3-none-any.whl
Installing collected packages: virtualenv
Successfully installed virtualenv-15.1.0
这样保证你的virtualenv会创建在你自己的目录下,并且创建成功后会有文件路径,一般是存在一个./local的隐形文件夹下。为了方便可以创建一个专门管理python版本的文件夹
$ mkdir pythonenv
$ cd pythonenv
$ virtualenv --system-site-package tf0.10 //创建python虚拟环境
$ source tf0.10/bin/activate //启动python的虚拟环境,启动后命令前面就有了当前的python虚拟环境的名称 eg:(tf0.10)
上面的virtualenv –system-site-package tf0.10我没有运行成功,感觉是因为不是root权限安装没有软链到bin下的原因,所以用了下面这句话
$ .local/lib/python2.7/site-packages/virtualenv.py -p /usr/bin/python2.7 tf0.10
-p后面的是创建虚拟环境用到的python编译器,如果你用的是其他版本的python可以换成其他的
至此,virtualenv已经安装成功并且启动成功
安装TensorFlow
$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow-0.10.0-cp27-none-linux_x86_64.whl
$ pip install $TF_BINARY_URL
gjh@gjh-System-Product-Name:~$ mkdir pythonenv
gjh@gjh-System-Product-Name:~$ cd pythonenv
gjh@gjh-System-Product-Name:~/pythonenv$ virtualenv --system-site-package tf0.10
New python executable in /home/gjh/pythonenv/tf0.10/bin/python
Installing setuptools, pip, wheel...done.
gjh@gjh-System-Product-Name:~/pythonenv$ source tf0.10/bin/activate
(tf0.10) gjh@gjh-System-Product-Name:~/pythonenv$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow-0.10.0-cp27-none-linux_x86_64.whl
(tf0.10) gjh@gjh-System-Product-Name:~/pythonenv$ pip install $TF_BINARY_URL
Collecting tensorflow==0.10.0 from https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow-0.10.0-cp27-none-linux_x86_64.whl
/home/gjh/pythonenv/tf0.10/local/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:318: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#snimissingwarning.
SNIMissingWarning
/home/gjh/pythonenv/tf0.10/local/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#insecureplatformwarning.
InsecurePlatformWarning
Downloading https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow-0.10.0-cp27-none-linux_x86_64.whl (102.0MB)
100% |████████████████████████████████| 102.0MB 20kB/s
Requirement already satisfied: numpy>=1.8.2 in /usr/local/lib/python2.7/dist-packages (from tensorflow==0.10.0)
Requirement already satisfied: mock>=2.0.0 in /usr/local/lib/python2.7/dist-packages (from tensorflow==0.10.0)
Collecting protobuf==3.0.0b2 (from tensorflow==0.10.0)
/home/gjh/pythonenv/tf0.10/local/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#insecureplatformwarning.
InsecurePlatformWarning
Downloading protobuf-3.0.0b2-py2.py3-none-any.whl (326kB)
100% |████████████████████████████████| 327kB 217kB/s
Requirement already satisfied: wheel in ./tf0.10/lib/python2.7/site-packages (from tensorflow==0.10.0)
Requirement already satisfied: six>=1.10.0 in /usr/local/lib/python2.7/dist-packages (from tensorflow==0.10.0)
Requirement already satisfied: funcsigs>=1; python_version < "3.3" in /usr/local/lib/python2.7/dist-packages (from mock>=2.0.0->tensorflow==0.10.0)
Requirement already satisfied: pbr>=0.11 in /usr/local/lib/python2.7/dist-packages (from mock>=2.0.0->tensorflow==0.10.0)
Requirement already satisfied: setuptools in ./tf0.10/lib/python2.7/site-packages (from protobuf==3.0.0b2->tensorflow==0.10.0)
Installing collected packages: protobuf, tensorflow
Found existing installation: protobuf 3.4.0
Not uninstalling protobuf at /usr/local/lib/python2.7/dist-packages, outside environment /home/gjh/pythonenv/tf0.10
Successfully installed protobuf-3.0.0b2 tensorflow-0.10.0
- linux 下virtualenv及TensorFlow环境搭建与安装
- Virtualenv环境下安装TensorFlow
- 在Virtualenv安装tensorflow,配置linux环境 及eclipse环境
- linux下构建虚拟环境(virtualenv )安装tensorflow
- Mac 环境下安装 TensorFlow 使用Virtualenv 安装
- ubuntu14.04 下使用虚拟环境Virtualenv安装Tensorflow cpu
- mac 环境下给虚拟目录 Virtualenv 的 tensorflow 安装 opencv
- Linux环境下virtualenv安装和使用
- 零基础学TensorFlow(一):virtualenv及TensorFlow环境搭建
- Windows 下pip安装以及virtualenv环境搭建
- Linux 下 virtualenv 安装
- Linux下使用Virtualenv搭建Django开发环境
- pyenv和virtualenv在Linux下搭建python虚拟环境
- 【Python学习笔记】Linux环境下virtualenv安装和使用
- ubuntu16.04下virtualenv环境中, django与mysql安装
- Anaconda安装与tensorflow环境搭建
- CentOS 7 下使用虚拟环境Virtualenv安装Tensorflow cpu版记录
- CentOS 7 下使用虚拟环境Virtualenv安装Tensorflow cpu版记录
- Celery-4.1 用户指南: Monitoring and Management Guide
- 从日志到双十一大屏只要一步:LOG/SLS+DataV 打通
- fastDFS图片服务器的一些常见错误
- 小玩具——温度采集项目(五)
- OC与JS交互之UIWebView
- linux 下virtualenv及TensorFlow环境搭建与安装
- java中Set集合
- 使用RPM方式安装docker
- ThumbnailUtils.createVideoThumbnail 获取到的帧不是视频第一个关键帧
- Kali VMware14.0-Not enough physical memory
- Oracle是如何工作的?实例是如何响应用户请求?一条SQL的执行过程~
- Chrome快捷键大全:Chrome窗口和标签页快捷键、功能快捷键、网页快捷键
- DQL、DML、DDL、DCL的概念与区别
- 关于JS两道有意思的题--作用域与提升