window10安裝運(yùn)行tensorFlow-gpu

自己目前做視頻識別需要tensorflow-gpu加速,走了很多坑重裝好幾次系統(tǒng),終于實(shí)現(xiàn),現(xiàn)記錄如下:pycharm+tensorflow+1050TI+Python3.6=

目前網(wǎng)上復(fù)制嚴(yán)重,好多沒有實(shí)踐可行性。主要問題如下:使用Anconda情況下cuda不用另外安裝;cuda不需要額外配置,cudnn也不需要配置。GPU版本查看使用https://www.techpowerup.com/gpuz/

第一步 安裝anconda

下載anconda?Anconda下載網(wǎng)址

進(jìn)入cmd設(shè)置國內(nèi)鏡像

修改鏡像源

https://mirrors.tuna.tsinghua.edu.cn/help/anaconda/

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda/

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/menpo/

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/peterjc123/

conda config --set show_channel_urls yes

創(chuàng)建環(huán)境

conda create -n 虛擬環(huán)境名稱 python=3.7

激活環(huán)境

activate 虛擬環(huán)境名稱

退出環(huán)境 deactivate

刪除環(huán)境 conda env remove -n 虛擬環(huán)境名稱

依賴的三方包

conda install tensorflow

conda install tensorflow-gpu

第二步 安裝cuda cudnn

調(diào)用GPU,現(xiàn)在conda命令不太好用,pip好用,但關(guān)聯(lián)功能沒有conda省事。

使用conda命令安裝?

conda install cudatookit 會(huì)自動(dòng)安裝cudnn

第三步 驗(yàn)證cudn,cudnn ,GPU 是否可用

切換到python命令行:運(yùn)行以下命令

from tensorflow.python.client import device_lib as _device_lib

local_device_protos = _device_lib.list_local_devices()

第四步 安裝PyCharm 配置

File->Default Setting->Project Interpreter->conda Environment

在add Local中添加本地虛擬環(huán)境。

注意問題?

conda install tensorflow-gpu 會(huì)自動(dòng)關(guān)聯(lián)cuda及cudnn 查看版本是否匹配

python 版本與tensorflow-gpu版本是否匹配

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

友情鏈接更多精彩內(nèi)容