Windows下pycharm使用theano的方法

來源:互聯網
上載者:User

標籤:div   tool   查看   配置   檔案夾   .config   lin   ted   erro   

  安裝theano前需要自行安裝Anaconda和PyCharm。在網上查了在PyCharm上安裝theano的方法,但是均遇到了一些問題,現將問題與解決方案介紹如下。

(一)第一種安裝方式

  開啟cmd命令視窗或者Anaconda命令視窗,輸入 pip install theano。 

  斷行符號後看到下載與安裝的進度條,但是這樣安裝過後直接import theano會報錯。於是我又使用了第二種方法。

(二)第二種安裝方式

  1.手動下載theano的zip檔案

  :https://github.com/Theano/Theano ,解壓後找到XXX/Anaconda/Lib/site-packages/theano(檔案裡面有個theano的檔案夾)

  將這個檔案夾複製粘貼到E:/Anaconda/Lib/site-packages裡面)(這個路徑是你自己Anaconda的路徑)。

  2.查看你的Anaconda路徑下有沒有MinGW檔案夾,如果有,直接跳到第3步。

  下面安裝MinGW包,CMD輸入conda install mingw libpython ,MinGW會自動裝到Anaconda下。

  3.配置環境變數。 

  添加環境變數:path: XXX/Anaconda/MinGW/bin;E:/Anaconda/MinGW/x86_64-w64-mingw32/lib;(按照自己的路徑修改)  

                                (32bit  E:/Anaconda/MinGW/i686-w64-mingw32/lib;)   

       建立環境變數:  PYTHONPATH: E:/Anaconda/Lib/site-packages/theano;

(三)測試theano

  cmd中,輸入python進入python環境下,輸入import theano斷行符號,如果沒有error則配置成功。

(四)出現的問題

  1.WARNING (theano.configdefaults): g++not available, if using conda: `conda install m2w64-toolchain`

     WARNING (theano.configdefaults): g++not detected ! Theano will be unable to execute optimized C- imp

    解決方案:cmd視窗輸入conda install m2w64-toolchain

  2.cmd命令視窗輸入conda list,查看有沒有libpython,如果沒有,則解決方案:

  cmd視窗輸入conda install libpython

  3.Traceback (most recent call last):
           File "", line 1, in
           File "E:\jing\Anaconda\lib\site-packages\theano__init__.py", line 55, in  from theano.compile import \
           File "E:\jing\Anaconda\lib\site-packages\theano\compile__init__.py", line 9, in   from theano.compile.function_module import *
           File "E:\jing\Anaconda\lib\site-packages\theano\compile\function_module.py", line 16, in from theano import gof
           ImportError: cannot import name gof

  明明有gof,但是顯示無法匯入。

  解決方案:在“C:/USERS/使用者名稱”目錄下(根據電腦不同這個可能不同,如果不知道可以通過cmd查詢,預設的就是這個路徑)。

  找到這個路徑後,建立“.theanorc.txt”檔案,輸入以下內容:

  [global]

    openmp=False  [blas]  ldflags=  [gcc]  cxxflags = -IC:/MinGW/include 

(四)總結

  綜上是我安裝過程中遇到的一些錯誤以及解決方案,歡迎討論。

 

  

Windows下pycharm使用theano的方法

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.