Windows + Tensorflow + Pycharm + CUDA + cuDNN + VS2017 + Anaconda 安装

mac2024-12-05  24

由于最近没时间,花了一天搭了一下,个人总结了点小tips

Markdown 直接粘过来的,

包含了Vmware+Ubuntu搭配虚拟机(目前没用到

个人配置 Win10 + VS2017 + CUDA9 + cuDNN7 + Py3.5 + tensorflow1.5 + keras2.1.4 + opencv最新 + Anaconda最新 可以正常使用。

安装顺序 VS2017 -- Anaconda --- Python --- CUDA --- cuDNN --- Tensorflow-GPU --- PyCharm

# 教程 http://www.bubuko.com/infodetail-2465293.html https://blog.csdn.net/XunCiy/article/details/89016510 https://www.cnblogs.com/caizhou520/p/11219985.html https://www.cnblogs.com/yuxuefeng/articles/9235431.html

## 报错 #### 1type https://blog.csdn.net/bigdream123/article/details/99467316

_np_qint8 = np.dtype([("quint8", np.uint8, (1,))]) _np_quint8 = np.dtype([("quint8", np.uint8, (1,))]) _np_qint16 = np.dtype([("qint16", np.int16, (1,))]) _np_quint16 = np.dtype([("quint16", np.uint16, (1,))]) _np_qint32 = np.dtype([("qint32", np.int32, (1,))])

np_resource = np.dtype([("resource", np.ubyte, (1,))])

#### Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 (CPU垃圾) https://blog.csdn.net/jackfjw/article/details/83046283 ####  failed to create cublas handle: CUBLAS_STATUS_ALLOC_FAILED (内存不够) gpu_options = tf.GPUOptions(per_process_gpu_memory_fraction=0.333) sess = tf.Session(config=tf.ConfigProto(gpu_options=gpu_options))

## pycharm https://www.cnblogs.com/wqzn/p/10424892.html

## VMWARE https://www.7down.com/soft/310739.html * 开机 F2-config-Visual Tech 开启

## Ubuntu https://www.jianshu.com/p/94aa39bcd39d?tdsourcetag=s_pcqq_aiomsg

## pip镜像 1) C:\users\xxx\ 含有.python 什么的文件夹 新建文件夹pip 2) 新建文件pip.ini并编辑如下 [global] index-url = https://pypi.tuna.tsinghua.edu.cn/simple [install] trusted-host=mirrors.aliyun.com

#### GPU-Tensorflow 需要CUDA,cuDNN

## CUDA & cuDNN

1) 计算机-管理-系统工具-设备管理器-显示适配器查-看显卡 2) 控制面板-NVIDIA控制面板-帮助-系统信息-组件-NVCUDA.DLL 看最高支持版本 3) “C:\Program Files\NVIDIA Corporation\NVSMI” --- 路径加入计算机的Path         cmd -- nvidia-smi -- 查看Driver Version 查看最高支持版本* CUDA-cuDNN--版本搭配* 下载CUDA & cuDNN https://www.cnblogs.com/xiaojianliu/p/9286066.html cuDNN解压后文件移动到同名CUDA文件夹内

* 验证CUDA版本 C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\extras\demo_suite\ bandwidthTest.exe & deviceQuery.exe cmd运行是否pass

## VS2017 https://www.jianshu.com/p/320aefbc582d

## Anaconda

https://www.anaconda.com/distribution/ * 安装时候add path * 安装完cmd改conda镜像     conda config --add channels         https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/     conda config --set show_channel_urls yes

#### 基本命令 * 更新包  //conda upgrade --all  * 装np,注意:每个环境都要重新装一遍包,tensorflow不要装会冲突 conda install numpy scipy pandas * 查看所有包配置(pip freeze) conda env export  * 查看所有环境 conda env list * 退出环境 conda deactivate tensorflow_py3.5 * 删除环境 conda remove -n tensorflow_py3.5 --all * 创建环境 conda create --name tensorflow_py3.5 python=3.5 * 激活环境 conda activate tensorflow_py3.5 * 复制环境 conda create -n dltest_py3.5 --clone deeplearning_py3.5

#### 安装 *  创建环境 conda create --name tensorflow_py3.5 python=3.5 * 激活环境 conda activate tensorflow_py3.5 * 升级pip python -m pip install --upgrade pip * 最新版tf,慎用 * pip3 install --ignore-installed --upgrade tensorflow-gpu * 安装tf-GPU版本 pip3 install tensorflow-gpu==1.5 * 安装tf-CPU pip3 install --ignore-installed --upgrade tensorflow * 配置CUDA适应tf dlerror: cudart64_100.dll not found C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\bin\ -- 相应文件后缀改成100 ##### tensorflow测试  import tensorflow as tf #构造计算图 hello = tf.constant("Hello") #执行计算图 sess = tf.Session() print(sess.run(hello))

##### Git conda install git ##### Keras pip3 install -U keras=2.1.4 * 测试 https://blog.csdn.net/Snowy_susu/article/details/81836824 ##### OpenCV pip3 install -U opencv-contrib-python * 测试 import cv2 import numpy as np img = cv2.imread('D:/aa.jpg', cv2.IMREAD_COLOR) cv2.imshow("image", img) cv2.waitKey(0)  

最新回复(0)