1,升級pip
(1)在prompt中,以管理員權限運行
pip install --upgrade pip
(2)在cmd中,以管理員運行
python -m pip install --upgrade pip
錯誤:
Script file ‘D:\Users\Administrator\Anaconda3\Scripts\pip-script.py’ is not present.
解決方法:easy_install pip
2,anaconda中添加channel
(1)清華鏡像
(D:\Users\Administrator\Anaconda3) C:\Users\Administrator>conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
(D:\Users\Administrator\Anaconda3) C:\Users\Administrator>conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
(D:\Users\Administrator\Anaconda3) C:\Users\Administrator>conda config --set show_channel_urls yes
(2)中科大鏡像
(D:\Users\Administrator\Anaconda3) C:\Users\Administrator>conda config --add channels https://mirrors.ustc.edu.cn/anaconda/pkgs/free/
(D:\Users\Administrator\Anaconda3) C:\Users\Administrator>conda config --set show_channel_urls yes
3,遇到問題ERROR: tensorboard 1.14.0 has requirement setuptools>=41.0.0, but you’ll have setuptools 36.4.0 which is incompatible.:
在安裝:
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple tensorflow-gpu==1.14
解決辦法:
pip install tensorboard
註釋:最後出了問題:
import tensorboard.lazy as _lazy
AttributeError: module ‘tensorboard’ has no attribute ‘lazy’
解決辦法:
pip uninstall tensorboard
pip uninstall tensorflow-gpu
重新裝:
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple tensorflow-gpu==1.14
現在測試成功:
>>> import tensorflow
>>> from tensorflow.python.client import device_lib
>>> print(device_lib.list_local_devices())
2019-07-21 09:59:39.657281: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2
2019-07-21 09:59:39.661258: I tensorflow/stream_executor/platform/default/dso_loader.cc:42] Successfully opened dynamic library nvcuda.dll
2019-07-21 09:59:40.617377: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1640] Found device 0 with properties:
name: GeForce GTX 1050 Ti major: 6 minor: 1 memoryClockRate(GHz): 1.62
pciBusID: 0000:01:00.0
2019-07-21 09:59:40.621751: I tensorflow/stream_executor/platform/default/dlopen_checker_stub.cc:25] GPU libraries are statically linked, skip dlopen check.
2019-07-21 09:59:40.629822: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1763] Adding visible gpu devices: 0
2019-07-21 09:59:41.207582: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1181] Device interconnect StreamExecutor with strength 1 edge matrix:
2019-07-21 09:59:41.210105: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1187] 0
2019-07-21 09:59:41.211590: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1200] 0: N
2019-07-21 09:59:41.220506: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1326] Created TensorFlow device (/device:GPU:0 with 3001 MB memory) -> physical GPU (device: 0, name: GeForce GTX 1050 Ti, pci bus id: 0000:01:00.0, compute capability: 6.1)
[name: "/device:CPU:0"
device_type: "CPU"
memory_limit: 268435456
locality {
}
incarnation: 17227910178020249398
, name: "/device:GPU:0"
device_type: "GPU"
memory_limit: 3146829004
locality {
bus_id: 1
links {
}
}
incarnation: 13565572337421704331
physical_device_desc: "device: 0, name: GeForce GTX 1050 Ti, pci bus id: 0000:01:00.0, compute capability: 6.1"
]
>>>
上述結果:環境:win10+cuda10.0+cudnn7.6.1+tensorflow1.14
4 ,遇到:ModuleNotFoundError: No module named ‘skimage’
解決方法:
pip install scikit-image