scipy安装在山狮失败

时间:2012-09-25 00:05:58

标签: macos scipy pip

当我尝试使用pip install scipy安装scipy时,它失败并带有以下回溯

Downloading/unpacking scipy
  Downloading scipy-0.10.1.tar.gz (6.2MB): 6.2MB downloaded
  Running setup.py egg_info for package scipy
    Running from scipy source directory.
    blas_opt_info:
      FOUND:
        extra_link_args = ['-Wl,-framework', '-Wl,Accelerate']
        define_macros = [('NO_ATLAS_INFO', 3)]
        extra_compile_args = ['-msse3', '-I/System/Library/Frameworks/vecLib.framework/Headers']

    non-existing path in '/private/var/folders/rd/fplkflh93ls54kbl5ylphl4h0000gn/T/pip-build/scipy/scipy/io': 'docs'
    lapack_opt_info:
      FOUND:
        extra_link_args = ['-Wl,-framework', '-Wl,Accelerate']
        define_macros = [('NO_ATLAS_INFO', 3)]
        extra_compile_args = ['-msse3']

    umfpack_info:
      libraries umfpack not found in /usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib
      libraries umfpack not found in /usr/local/lib
      libraries umfpack not found in /usr/lib
    /usr/local/lib/python2.7/site-packages/numpy/distutils/system_info.py:470: UserWarning:
        UMFPACK sparse solver (http://www.cise.ufl.edu/research/sparse/umfpack/)
        not found. Directories to search for the libraries can be specified in the
        numpy/distutils/site.cfg file (section [umfpack]) or by setting
        the UMFPACK environment variable.
      warnings.warn(self.notfounderror.__doc__)
      NOT AVAILABLE

    Traceback (most recent call last):
      File "<string>", line 16, in <module>
      File "/var/folders/rd/fplkflh93ls54kbl5ylphl4h0000gn/T/pip-build/scipy/setup.py", line 196, in <module>
        setup_package()
      File "/var/folders/rd/fplkflh93ls54kbl5ylphl4h0000gn/T/pip-build/scipy/setup.py", line 187, in setup_package
        configuration=configuration )
      File "/usr/local/lib/python2.7/site-packages/numpy/distutils/core.py", line 152, in setup
        config = configuration()
      File "/var/folders/rd/fplkflh93ls54kbl5ylphl4h0000gn/T/pip-build/scipy/setup.py", line 138, in configuration
        config.add_subpackage('scipy')
      File "/usr/local/lib/python2.7/site-packages/numpy/distutils/misc_util.py", line 1002, in add_subpackage
        caller_level = 2)
      File "/usr/local/lib/python2.7/site-packages/numpy/distutils/misc_util.py", line 971, in get_subpackage
        caller_level = caller_level + 1)
      File "/usr/local/lib/python2.7/site-packages/numpy/distutils/misc_util.py", line 908, in _get_configuration_from_setup_py
        config = setup_module.configuration(*args)
      File "scipy/setup.py", line 20, in configuration
        config.add_subpackage('special')
      File "/usr/local/lib/python2.7/site-packages/numpy/distutils/misc_util.py", line 1002, in add_subpackage
        caller_level = 2)
      File "/usr/local/lib/python2.7/site-packages/numpy/distutils/misc_util.py", line 971, in get_subpackage
        caller_level = caller_level + 1)
      File "/usr/local/lib/python2.7/site-packages/numpy/distutils/misc_util.py", line 908, in _get_configuration_from_setup_py
        config = setup_module.configuration(*args)
      File "/private/var/folders/rd/fplkflh93ls54kbl5ylphl4h0000gn/T/pip-build/scipy/scipy/special/setup.py", line 54, in configuration
        extra_info=get_info("npymath")
      File "/usr/local/lib/python2.7/site-packages/numpy/distutils/misc_util.py", line 2220, in get_info
        pkg_info = get_pkg_info(pkgname, dirs)
      File "/usr/local/lib/python2.7/site-packages/numpy/distutils/misc_util.py", line 2172, in get_pkg_info
        return read_config(pkgname, dirs)
      File "/usr/local/lib/python2.7/site-packages/numpy/distutils/npy_pkg_config.py", line 390, in read_config
        v = _read_config_imp(pkg_to_filename(pkgname), dirs)
      File "/usr/local/lib/python2.7/site-packages/numpy/distutils/npy_pkg_config.py", line 326, in _read_config_imp
        meta, vars, sections, reqs = _read_config(filenames)
      File "/usr/local/lib/python2.7/site-packages/numpy/distutils/npy_pkg_config.py", line 309, in _read_config
        meta, vars, sections, reqs = parse_config(f, dirs)
      File "/usr/local/lib/python2.7/site-packages/numpy/distutils/npy_pkg_config.py", line 281, in parse_config
        raise PkgNotFound("Could not find file(s) %s" % str(filenames))
    numpy.distutils.npy_pkg_config.PkgNotFound: Could not find file(s) ['/usr/local/lib/python2.7/site-packages/numpy/core/lib/npy-pkg-config/npymath.ini']

我正在使用Mountain Lion,以及使用自制软件安装的python 2.7.3,并使用pip install numpy安装了numpy。

为什么scipy安装失败?

4 个答案:

答案 0 :(得分:9)

这似乎是pip和numpy的一个问题,它不会将已编译的库复制到site-packages目录中。

您可以使用pip安装到virtualenv(这对我有用) 要么 使用

从源代码安装
python setup.py install

方法

这里有一些关于问题的评论:

http://www.thisisthegreenroom.com/2011/installing-python-numpy-scipy-matplotlib-and-ipython-on-lion/

答案 1 :(得分:8)

如果您使用自制程序,则可以尝试以下操作(感谢https://github.com/pypa/pip/issues/707):

brew tap samueljohn/homebrew-python
brew install numpy
brew install scipy

答案 2 :(得分:4)

如果您不使用virtualenv,则可以手动编辑/usr/local/lib/python2.7/site-packages/pip-1.2.1-py2.7.egg/pip/locations.py最少侵入性的修补程序(您的点数版本可能会有所不同)。只需替换第35行:

build_prefix = os.path.join(tempfile.gettempdir(), 'pip-build') 

为:

build_prefix = os.path.realpath(os.path.join(tempfile.gettempdir(), 'pip-build')) 

完成此更改后,您需要重新安装numpypip uninstall numpy; pip install numpy)。然后可以通过pip正确安装scipy

问题是由pip bug引起的。上面的解决方案是根据the pip patch(Lokkju提到的the issue discussion中提出的)来自github用户qwcode。此补丁似乎已合并到主pip存储库。但是,由于它与Python捆绑在一起,我看不到简单的方法来刷新更新点。所以只需手动制作这个简单的修复就可以了。

答案 3 :(得分:0)

我在2015年与MacOSX Yosemite有同样的问题。我认为它是由pip的旧版本bug造成的。卸载pip并获取它的最新版本会有所帮助。 从https://pip.pypa.io/en/latest/installing.html获取点子 然后

$ sudo pip uninstall scipy
$ sudo pip install scipy