1. 程式人生 > >從python2切換到python3.6環境後,出現No module named 'theano'錯誤

從python2切換到python3.6環境後,出現No module named 'theano'錯誤

場景:從python2通過activate Python36切換到python3.6環境後,在python中import theano時,出現import theano ModuleNotFoundError: No module named 'theano'的錯誤,(即便在python2下又已經安裝過theano)。為了解決缺theano的問題,要做兩個動作:

1、從環境變數中,刪除pythonpath:因為pip會利用這個pythonpath搜尋theano,如果python2下已經安裝過theano,就會阻止pip安裝theano;

2、重啟電腦;

3、儘量用conda安裝theano,尤其是在windows:conda install theano pygpu

4、或者在python36環境下安裝對應版本的theano:pip install theano;