在 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/。我做错了什么?

编辑:澄清一下,我在虚拟环境中执行此操作。

编辑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.version.版本

‘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

相关内容