處理器:I5-7500
顯卡 :GTX1050Ti
系統 :Win10
1. 首先搭建Python環境。
官網https://www.python.org/downloads/下載Python3.7(目前最新的版本為3.7.4,暫時不用最新版本)。下載安裝完成后在環境變量中添加bin路徑。
cmd 運行 python 查看是否配置成功。
C:\Users\admin>python Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>>
2. 下載Cuda
官網鏈接:https://developer.nvidia.com/cuda-downloads
網盤鏈接:https://pan.baidu.com/s/1K_PEdQ-aJRu3mnCpVvPREQ
提取碼:l2vw
按步驟安裝。
3. Cuddn
鏈接:https://pan.baidu.com/s/1BXCwyUb6fUF7ULfKJd_8VA
提取碼:qlgy
將解壓出來的文件替換到CUDA\v10.0\bin目錄下。
cmd 運行 nvcc -V 查看是否安裝成功。
C:\Users\admin>nvcc -V nvcc: NVIDIA (R) Cuda compiler driver Copyright (c) 2005-2018 NVIDIA Corporation Built on Sat_Aug_25_21:08:04_Central_Daylight_Time_2018 Cuda compilation tools, release 10.0, V10.0.130
4.tensorflow安裝
1> 通過pip install --upgrade tensorflow-gpu 安裝,驗證是否成功。
import tensorflow as tf hello = tf.constant('Hello, TensorFlow!') sess = tf.Session() print(sess.run(hello))
2>打開pycharm,在菜單欄里Flie-Settings-Project-Project interpreter,選擇Python3 interpreter,然后點擊+按鈕,輸入tensorflow-gpu,install package。