在 Ubuntu 中安裝 scipy

在 Ubuntu 中安裝 scipy

所以每當我嘗試

pip install -U scikit-learn 

我得到:

ImportError: libatlas.so.3gf: cannot open shared object file: No such file or directory

我確保我atlas-base的目錄中有/usr/lib/。我究竟做錯了什麼?

編輯:澄清,我正在 virtualenv 中執行此操作。

編輯2:有人建議我使用sudo apt-get install python-scipy,這就是我嘗試導入時得到的結果:

>>> import sklearn
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/scikit_learn-0.13-py2.7-linux-x86_64.egg/sklearn/__init__.py", line 32, in <module>
    from .base import clone
  File "/usr/local/lib/python2.7/dist-packages/scikit_learn-0.13-py2.7-linux-x86_64.egg/sklearn/base.py", line 9, in <module>
    import numpy as np
  File "/usr/lib/python2.7/dist-packages/numpy/__init__.py", line 137, in <module>
    import add_newdocs
  File "/usr/lib/python2.7/dist-packages/numpy/add_newdocs.py", line 9, in <module>
    from numpy.lib import add_newdoc
  File "/usr/lib/python2.7/dist-packages/numpy/lib/__init__.py", line 13, in <module>
    from polynomial import *
  File "/usr/lib/python2.7/dist-packages/numpy/lib/polynomial.py", line 17, in <module>
    from numpy.linalg import eigvals, lstsq
  File "/usr/lib/python2.7/dist-packages/numpy/linalg/__init__.py", line 48, in <module>
    from linalg import *
  File "/usr/lib/python2.7/dist-packages/numpy/linalg/linalg.py", line 23, in <module>
    from numpy.linalg import lapack_lite
    ImportError: /usr/lib/liblapack.so.3gf: undefined symbol: ATL_chemv

編輯3:修復了 numpy 的一些依賴關係問題後,我現在得到:

   import fblas
ImportError: libatlas.so.3gf: cannot open shared object file: No such file or directory

答案1

若要取得依賴項,請嘗試

sudo apt-get install python python-dev libatlas3-base-dev gcc gfortran g++

另外,您應該檢查 numpy 是否是最新的:

>> 導入numpy

>> numpy.版本.版本

‘1.6.1’

(例如)。我認為您需要 numpy > 1.5.0 作為最新的 scipy 發行版。

然後您可以嘗試sudo apt-get install python-scipy其他答案中建議的命令。

答案2

sudo apt-get 安裝 python-sklearn

編輯:

hdante@aielwaste:~$ python
Python 2.7.3 (default, Sep 26 2012, 21:51:14) 
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sklearn
>>> 

答案3

sudo apt-get install python-scipy

答案4

我可以透過以下方式工作

echo "/usr/lib/atlas-base" | sudo tee /etc/ld.so.conf.d/atlas-lib.conf
sudo ldconfig

感謝這個主題: https://unix.stackexchange.com/questions/52703/using-atlas-from-scipy

相關內容