ubuntu 安裝cuda 9.1 pytorch 0.3.0


畢業再沒用配過機器學習的環境了,既親切又陌生,久違了。

系統 mint18  x64

1安裝cuda

  按官網提示 選的9.1版  https://developer.nvidia.com/cuda-toolkit

2安裝Anaconda3

  從清華的鏡像站下載https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/

  從最下面選Anaconda3-5.0.1-Linux-x86_64

 在下載 路徑下 執行 

   bash ./Anaconda3-5.0.1-Linux-x86_64.sh  

安裝好之后,按提示

export PATH=/home/machinelearning/anaconda3/bin:$PATH

並添加到

xed ~/.profile  (不是bashrc,因為換成了zsh)

然后source ~/.profile

 

切換清華的源

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 --set show_channel_urls yes

安裝好之后,已經可以使用

anaconda-navigator

 

3Pytorch

直接在官網按按鈕選版本http://pytorch.org/

如果沒切換清華源,可能會奇慢無比。

 

結果還是極其慢,我倒。

只好從源碼編譯了

參考這個http://blog.csdn.net/draco_mystack/article/details/71191924 和pytorch的github https://github.com/pytorch/pytorch#from-source

CMAKE_PREFIX_PATH="$(dirname $(which conda))/../"
conda install numpy pyyaml mkl setuptools cmake cffi  
(還好,這幾個清華的鏡像站里都有)
conda install -c soumith magma-cuda90
(我的cuda下載nv官網的9.1 參考pytorch官網生成的安裝命令行,所以弄了個90.原文是80)
雖然這一步還是有點慢,但是已經可以忍受了

 還是特別慢。

 

最后參考https://github.com/dnouri/skorch

直接從anaconda里起控制台,pip安裝了

pip install http://download.pytorch.org/whl/cu90/torch-0.3.0.post4-cp36-cp36m-linux_x86_64.whl


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM