Error importing theano “cannot import name gof”

前端 未结 4 2117
迷失自我
迷失自我 2021-01-12 01:15

I am current getting the error

ImportError: cannot import name gof

when importing theano.

>>> import          


        
4条回答
  •  悲哀的现实
    2021-01-12 01:46

    I assume you're using Windows 7 or later.

    If you have installed Python Anaconda, then open Windows Powershell or Command Prompt and type conda install mingw libpython before typing pip install theano

    Alternatively, if you don't have Anaconda, download those packages from

    • anaconda.org/anaconda/mingw/files
    • anaconda.org/anaconda/libpython/files
    • github.com/Theano/Theano

    Then open Command Prompt, navigate to each folder and type python setup.py install

    Now run Python and import theano

    Possible errors:

    If you get the RuntimeError: "To use MKL 2018 with Theano you MUST set "MKL_THREADING_LAYER=GNU" in your environement" then

    1. Go to Control Panel > System > Advanced system settings and select "Environment Variables".

    2. In the "System variables" section, make a new variable name MKL_THREADING_LAYER and set its value to GPU

    If you get other kinds of errors, then try the following:

    1. Make an empty file called .theanorc (a file extension without a file name) in your home folder C:\Users\. If you get the error "You must type a file name" then see stackoverflow.com/q/5004633

    2. Open .theanorc and write this:

      [global]
      cxx=C:\\Anaconda3\MinGW\bin\g++.exe
      
    3. Run Python again and import theano. If it works, then you can probably delete .theanorc

提交回复
热议问题