Anaconda下配置多python版本深度学习开发环境
- 环境创建
- tensorflow-gpu1.8安装
- keras2.1安装
- opencv安装
- 安装速度缓慢的问题
创建环境
- 指令为:conda create -n pythpn36 python=3.6,会自动创建名为python36的环境,且环境中会安装好Python3.6;
- 在创建环境之前可以用指令conda info -e 查看已有的环境
安装 tensorflow-gpu1.8
- 首先激活创建的环境:source activate python36;
- 利用指令:pip install tensorflow-gpu==1.8安装tensorflow,下载速度太慢,出现错误,再次下载,还是报错;
- 修改镜像源为清华大学镜像源,提升下载速度,指令如下:pip install -i https://pypi.tuna.tsinghua.edu.cn/simple tensorflow-gpu == 1.8
安装keras2.1
- 利用指令:pip install keras==1.8安装keras,下载速度太慢,出现错误,再次下载,还是报错;
- 修改镜像源为清华大学镜像源,提升下载速度,指令如下:pip install -i https://pypi.tuna.tsinghua.edu.cn/simple keras == 2.1
安装opencv
- 指令如下:pip install -i https://pypi.tuna.tsinghua.edu.cn/simple opencv-python
下载速度慢的问题
- 临时的方法:添加镜像源,例如:pip install -i https://pypi.tuna.tsinghua.edu.cn/simple opencv-python
- 永久的方法:添加镜像源至系统配置文件,需要创建或修改配置文件(linux的文件放在~/.pip/pip.conf,windows在%HOMEPATH%\pip\pip.ini,目录不存在,手动创建) 在~/.pip/pip.conf中添加如下两行代码:
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
trusted-host = pypi.tuna.tsinghua.edu.cn - 常用的源有:豆瓣的源 :http://pypi.douban.com/simple/ ;清华大学:http://pypi.tuna.tsinghua.edu.cn/simple