Win10+Tensorflow-gpu+Anaconda安装

1、 Anaconda安装
直接安装Anaconda3-5.2.0-Windows-x86_64.exe,这里注意在安装过程中,要选择添加路径。
下载链接:https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/或https://repo.anaconda.com/archive/
ubuntu:
vim ~/.bashrc
echo ‘export PATH=“/home/你的用户名/anaconda2/bin:$PATH”’ >> ~/.bashrc
source ~/.bashrc

macos:
sudo vim .zshrc
export PATH=“/Users/用户名/anaconda3/bin:$PATH”
source .zshrc

2、 Tensorflow-gpu安装
在开始菜单中找到打开Anaconda Prompt打开。

conda create -n tensorflow-gpu pip python=3.6	# 创建tensorflow-gpu环境
activate tensorflow-gpu					        # 在tensorflow-gpu环境下操作
# export PATH=~/anaconda3/bin:$PATH				# mac激活指令
# source activate tensorflow						# mac激活指令
conda install tensorflow-gpu=1.15.0		        # 安装tensorflow-gpu环境
conda env remove -n 环境名 						# 删除虚拟环境

安装相应插件

conda install -c anaconda protobuf
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple/ pillow
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple/ lxml
pip install -i https://pypi.doubanio.com/simple jupyter
pip install -i https://pypi.doubanio.com/simple matplotlib
pip install -i https://pypi.doubanio.com/simple pandas
pip install -i https://pypi.doubanio.com/simple opencv-python
pip install -i https://pypi.doubanio.com/simple opencv-contrib-python
pip install -i https://pypi.doubanio.com/simple cython
pip install easydict
pip install tqdm
pip install keras
pip install --upgrade tf_slim

3、 更改Anaconda下载镜像源
清华源

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/

上交源

conda config --add channels https://mirrors.sjtug.sjtu.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.sjtug.sjtu.edu.cn/anaconda/pkgs/main/

中科大源

conda config --add channels https://mirrors.ustc.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/pkgs/main/

默认源

conda config --remove-key channels

4、 安装labelImg标注插件

conda install pyqt=5			# 安装运行环境
pyrcc5 -o libs/resources.py resources.qrc
python labelImg.py				# 在../ labelImg-master/路径下执行,打开标注界面

参考链接:https://github.com/tzutalin/labelImg

5、 Tensorflow-gpu安装成功验证

import tensorflow as tf
tf.compat.v1.disable_eager_execution()
hello = tf.constant('Hello, TensorFlow!')
sess = tf.compat.v1.Session()
print(sess.run(hello))

6、 opencv安装成功验证

import cv2
img = cv2.imread("图片路径")
cv2.imshow("Image", img)
cv2.waitKey (0)
cv2.destroyAllWindows()

7、 安装过程报错及解决方案

报错:distributed 1.21.8 requires msgpack, which is not installed.
解决:pip install msgpack
报错:google-auth 1.15.0 has requirement setuptools>=40.3.0, but you'll have setuptools 39.1.0 which is incompatible.
解决:python -m pip install --upgrade pip
报错:Cannot uninstall 'wrapt'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.
解决:python -m pip install --upgrade pip
报错:ERROR: Cannot uninstall 'wrapt'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.
解决:pip install wrapt --ignore-installed
报错:import tensorflow.contrib.slim as slim
解决:import tf_slim as slim
报错:FutureWarning: Conversion of the second argument of issubdtype fromfloattonp.floatingis deprecated. In future, it will be treated asnp.float64 == np.dtype(float).type
解决:pip install --upgrade h5py

8、 参考链接

https://bingxiong.vip/18438/
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值