Unable to import numpy: Error: /usr/lib/liblapack.so.3: undefined symbol: gotoblas

前端 未结 2 598
旧巷少年郎
旧巷少年郎 2021-01-17 19:20

When I try to import numpy, I get the following error:

/usr/local/lib/python2.7/dist-packages/numpy/linalg/__init__.py in ()
     49 from .info         


        
相关标签:
2条回答
  • 2021-01-17 20:02

    To solve these issues, I followed the install bash script here: https://gist.github.com/amirsani/d2aa0763cc138902bf73

    I still had the same error occur during testing at the ending of all the installation so I did this

    sudo apt-get remove libopenblas-base
    

    Which I got from here: Installing lapack for numpy

    This appears to have solved my original problem (similar to yours but not identical) where I was attempting to run the following from ipython

    from ortools.linear_solver import pywraplp
    

    which produced an identical error to the one you had.

    0 讨论(0)
  • 2021-01-17 20:19

    The error message shows that your numpy installation is in '/usr/local/lib', but apt-get will put numpy in '/usr/lib'. This suggests to me that you have another copy of numpy which was installed by another method (e.g. pip install). Check if you have a directory called /usr/lib/python2.7/dist-packages/numpy/. If so, you just need to make sure that Python imports numpy from here and not from '/usr/local/lib'.

    Try deleting, renaming or moving the directory /usr/local/lib/python2.7/dist-packages/numpy/, alternatively you can change sys.path from within Python.

    0 讨论(0)
提交回复
热议问题