win10+cuda10.2+cudnn+tensorflow+pycharm(第二台笔记本配置深度学习环境了)

换了新电脑,重新配置机器学习环境
电脑配置如下:win10+cuda10.2+cudnn+tensorflow+pycharmjie
接下来就记录下配置环境的过程和问题

1,首先你需要了解自己电脑的显卡驱动版本(即cuda版本和驱动版本)

具体方法见博客:https://blog.csdn.net/tjb132/article/details/105575017
这里值得一提的是,我们理解上的误区。
1)首先:我笔记本的显卡驱动版本是441.152的,cuda是10.2的(新买的,配置很新)。一开始我以为只能安装cuda10.2,后来才意识到,其实它可以安装10.2以下的版本。
2)其次,虽然看起来电脑好像已经安装了cuda,但其实不是这样子的,如果你要使用gpu加速的话,你还是需要老老实实的的去下载cuda来安装。
具体安装什么版本的cuda和cudnn,请继续往下看!
具体显卡驱动的cuda如何下载,见博客:https://blog.csdn.net/tjb132/article/details/106912343

2,了解当前的tensorflow版本和cuda版本的对应关系

也许你会好奇为什么不是直接安装,但这就是关键的地方。我们新机器的显卡驱动很新,但tensorflow的更新肯定跟不上,会有延迟。所以一定要先去查看当前最新的tensorflow能兼容的cuda版本是多少。不然,你一顿操作完成之后,你会发现一定搞不定的错误。ImportError: DLL load failed: 找不到指定的模块。(就是导入tensorflow模块出错)
还有一点就是显卡的算力问题。 具体请看博客https://blog.csdn.net/tjb132/article/details/105573442
直接 查看最新的tensorflow和cuda版本的对应关系见官网https://tensorflow.google.cn/install/source_windows#gpu

3,充分了解tensorflow和cuda的版本之后

选择一个比较新的配置。比如我现在选的是:tensorflow2.1.0+cuda10.1+cudnn10.1.
选择完毕之后就是安装的问题了。只要正常安装,一般不会出什么问题。但安装的时候会有很多注意事项,特别是系统环境配置问题。
我一开始不注意系统环境变量的配置,到处最后导入tensorflow模型的时候出错:
tensorflow ImportError: DLL load failed: 找不到指定的模块。

下面这两步的顺序可以对调。先安装哪个都行。但是,没有安装cuda和cudnn的话,最好不要在anaconda 中添加tensorflow环境

4, visual studio 软件 安装

先安装 visual studio 软件。因为tensorflow 2.0之后需要里边的某个文件。如果不安装的话会出现错误: ImportError: DLL load failed: 找不到指定的模块。
这是因为tensorflow2.x之后就没有某个c++文件(具体我忘记了),需要共用其他c软件中的那个文件。具体可以找到tensorflow官网查看
安装教程自行百度

5,cuda、cudnn的下载安装,及其注意事项

win10+cuda10.2+cudnn+tensorflow2.1.0配置机器学习环境(2)—— cuda和cudnn下载安装:https://blog.csdn.net/tjb132/article/details/106912343

6,anaconda的下载安装,及其注意事项

win10+cuda10.2+cudnn+tensorflow2.1.0配置机器学习环境(1)——anaconda详细安装教程:https://blog.csdn.net/tjb132/article/details/106912043

7,anaconda安装完成之后

anaconda安装完成之后可以通过相应的指令,添加tensorflow的python环境,以及添加tensorflow库。然后测试。

自编译tensorflow: 1.python3.5,tensorflow1.12; 2.支持cuda10.0,cudnn7.3.1,TensorRT-5.0.2.6-cuda10.0-cudnn7.3; 3.无mkl支持; 软硬件硬件环境:Ubuntu16.04,GeForce GTX 1080 TI 配置信息: hp@dla:~/work/ts_compile/tensorflow$ ./configure WARNING: --batch mode is deprecated. Please instead explicitly shut down your Bazel server using the command "bazel shutdown". You have bazel 0.19.1 installed. Please specify the location of python. [Default is /usr/bin/python]: /usr/bin/python3 Found possible Python library paths: /usr/local/lib/python3.5/dist-packages /usr/lib/python3/dist-packages Please input the desired Python library path to use. Default is [/usr/local/lib/python3.5/dist-packages] Do you wish to build TensorFlow with XLA JIT support? [Y/n]: XLA JIT support will be enabled for TensorFlow. Do you wish to build TensorFlow with OpenCL SYCL support? [y/N]: No OpenCL SYCL support will be enabled for TensorFlow. Do you wish to build TensorFlow with ROCm support? [y/N]: No ROCm support will be enabled for TensorFlow. Do you wish to build TensorFlow with CUDA support? [y/N]: y CUDA support will be enabled for TensorFlow. Please specify the CUDA SDK version you want to use. [Leave empty to default to CUDA 10.0]: Please specify the location where CUDA 10.0 toolkit is installed. Refer to README.md for more details. [Default is /usr/local/cuda]: /usr/local/cuda-10.0 Please specify the cuDNN version you want to use. [Leave empty to default to cuDNN 7]: 7.3.1 Please specify the location where cuDNN 7 library is installed. Refer to README.md for more details. [Default is /usr/local/cuda-10.0]: Do you wish to build TensorFlow with TensorRT support? [y/N]: y TensorRT support will be enabled for TensorFlow. Please specify the location where TensorRT is installed. [Default is /usr/lib/x86_64-linux-gnu]://home/hp/bin/TensorRT-5.0.2.6-cuda10.0-cudnn7.3/targets/x86_64-linux-gnu Please specify the locally installed NCCL version you want to use. [Default is to use https://github.com/nvidia/nccl]: Please specify a list of comma-separated Cuda compute capabilities you want to build with. You can find the compute capability of your device at: https://developer.nvidia.com/cuda-gpus. Please note that each additional compute capability significantly increases your build time and binary size. [Default is: 6.1,6.1,6.1]: Do you want to use clang as CUDA compiler? [y/N]: nvcc will be used as CUDA compiler. Please specify which gcc should be used by nvcc as the host compiler. [Default is /usr/bin/gcc]: Do you wish to build TensorFlow with MPI support? [y/N]: No MPI support will be enabled for TensorFlow. Please specify optimization flags to use during compilation when bazel option "--config=opt" is specified [Default is -march=native -Wno-sign-compare]: Would you like to interactively configure ./WORKSPACE for Android builds? [y/N]: Not configuring the WORKSPACE for Android builds. Preconfigured Bazel build configs. You can use any of the below by adding "--config=" to your build command. See .bazelrc for more details. --config=mkl # Build with MKL support. --config=monolithic # Config for mostly static monolithic build. --config=gdr # Build with GDR support. --config=verbs # Build with libverbs support. --config=ngraph # Build with Intel nGraph support. --config=dynamic_kernels # (Experimental) Build kernels into separate shared objects. Preconfigured Bazel build configs to DISABLE default on features: --config=noaws # Disable AWS S3 filesystem support. --config=nogcp # Disable GCP support. --config=nohdfs # Disable HDFS support. --config=noignite # Disable Apacha Ignite support. --config=nokafka # Disable Apache Kafka support. --config=nonccl # Disable NVIDIA NCCL support. Configuration finished 编译: bazel build --config=opt --verbose_failures //tensorflow/tools/pip_package:build_pip_package 卸载已有tensorflow: hp@dla:~/temp$ sudo pip3 uninstall tensorflow 安装自己编译的成果: hp@dla:~/temp$ sudo pip3 install tensorflow-1.12.0-cp35-cp35m-linux_x86_64.whl
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

biao169

创作不易,感谢您的支持,谢谢~

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值