TensorFlow安装环境
- 系统:Ubuntu 18.0.3
- Python版本:3.6.7(默认安装)
- 安装方式:pip + virtualenv
检查配置环境
$ python3 --version
$ pip3 --version
$ virtualenv --version
如果已安装这些软件包则可以开始安装TensorFlow,否则安装工具包
$ sudo apt update
$ sudo apt install python3-dev python3-pip
$ sudo pip3 install -U virtualenv # system-wide install
virtualenv创建虚拟环境
创建虚拟环境目录
$ virtualenv --system-site-packages -p python3 ./venv
--system-site-packages
参数使虚拟环境中的Python
继承系统全局中Python
的属性
文档中相关说明:If you build with virtualenv --system-site-packages ENV
, your virtual environment will inherit packages from /usr/lib/python2.7/site-packages
(or wherever your global site-packages directory is).
This can be used if you have control over the global site-packages directory, and you want to depend on the packages there. If you want isolation from the global system, do not use this flag.
If you need to change this option after creating a virtual environment, you can add (to turn off) or remove (to turn