最近为了学习深度成功安装了TensorFlow-GPU,找到一些不错的博客,分享给大家~
1、Windows上Anaconda+Python+Pycharm+CUDA+CUDnn实现tensorflow-gpu安装以及安装tenfolw-gpu过程中出现的各种问题以及相应解决办法
2、anaconda配置成python3.5 并安装tensorflow
基本上,这两个博客就可以了。但第二篇博客有小部分错误。
1)创建环境conda命令,应由conda create -n py35 python=3.5 anaconda改为:
conda create -n py35 python=3.5
2)我安装的TensorFlow版本是1.8.0,所以最后用的命令是:
pip install --upgrade --ignore-installed tensorflow==1.8.0
2020.7更新
虚拟环境管理
创建虚拟环境
conda create --name env_name python=version package_names
activate env_name # 激活虚拟环境
deactivate # 退出环境
conda remove -n your_env_name(虚拟环境名称) --all #删除虚拟环境
https://www.cnblogs.com/chenhuabin/p/10718471.html#_label2_0
在jupyter notebook上使用虚拟环境
# 为虚拟环境安装ipykernel
conda install -n env_name ipykernel
# 激活环境,并输入
python -m ipykernel install --user
https://blog.csdn.net/abcdefg0929/article/details/88530192
jupyter dead kernel问题
虚拟环境内核无法启动,查看一下jupyter notebook终端,发现报错为:
[I 15:50:44.250 NotebookApp] KernelRestarter: restarting kernel (4/5)
WARNING:root:kernel 14a1ef0b-3e51-4fd6-a34a-691c56bd9002 restarted
Traceback (most recent call last):
File "C:\Users\Administrator\Anaconda3\envs\tf2\lib\runpy.py", line 183, in _run_module_as_main
mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
File "C:\Users\Administrator\Anaconda3\envs\tf2\lib\runpy.py", line 142, in _get_module_details
return _get_module_details(pkg_main_name, error)
File "C:\Users\Administrator\Anaconda3\envs\tf2\lib\runpy.py", line 109, in _get_module_details
__import__(pkg_name)
File "C:\Users\Administrator\Anaconda3\envs\tf2\lib\site-packages\ipykernel\__init__.py", line 2, in <module>
from .connect import *
File "C:\Users\Administrator\Anaconda3\envs\tf2\lib\site-packages\ipykernel\connect.py", line 18, in <module>
import jupyter_client
File "C:\Users\Administrator\Anaconda3\envs\tf2\lib\site-packages\jupyter_client\__init__.py", line 4, in <module>
from .connect import *
File "C:\Users\Administrator\Anaconda3\envs\tf2\lib\site-packages\jupyter_client\connect.py", line 21, in <module>
import zmq
File "C:\Users\Administrator\Anaconda3\envs\tf2\lib\site-packages\zmq\__init__.py", line 47, in <module>
from zmq import backend
File "C:\Users\Administrator\Anaconda3\envs\tf2\lib\site-packages\zmq\backend\__init__.py", line 40, in <module>
reraise(*exc_info)
File "C:\Users\Administrator\Anaconda3\envs\tf2\lib\site-packages\zmq\utils\sixcerpt.py", line 34, in reraise
raise value
File "C:\Users\Administrator\Anaconda3\envs\tf2\lib\site-packages\zmq\backend\__init__.py", line 27, in <module>
_ns = select_backend(first)
File "C:\Users\Administrator\Anaconda3\envs\tf2\lib\site-packages\zmq\backend\select.py", line 28, in select_backend
mod = __import__(name, fromlist=public_api)
File "C:\Users\Administrator\Anaconda3\envs\tf2\lib\site-packages\zmq\backend\cython\__init__.py", line 6, in <module>
from . import (constants, error, message, context,
ImportError: DLL load failed: 找不到指定的模块。
根据报错原因百度一下:
https://blog.csdn.net/lwgkzl/article/details/85202207
pip uninstall pyzmq
pip install pyzmq
# 解决。。。哭嘤嘤
安装记录
安装tensorflow 2.1.0
1、配置对应CUDA、cudaNN
https://blog.csdn.net/weixin_44170512/article/details/103990592
2、创建新环境并安装tensorflow
# 创建虚拟环境
conda create --name python36 python=3.6
# 直接安装tf2
pip install tensorflow==2.1.0
# pip>=19.0