在Python 3.10上安装SciPy遇到的问题。

3
这是我尝试安装scipy时得到的输出结果:

pip install scipy

    ERROR: Command errored out with exit status 1:
         command: /Library/Frameworks/Python.framework/Versions/3.10/bin/python3.10 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/dm/ydr8mjcd4_z1snyrs0hzrd840000gn/T/pip-install-swd6xkjh/scipy_53c3cdd4e8e2447f841731b3161ea9a3/setup.py'"'"'; __file__='"'"'/private/var/folders/dm/ydr8mjcd4_z1snyrs0hzrd840000gn/T/pip-install-swd6xkjh/scipy_53c3cdd4e8e2447f841731b3161ea9a3/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/dm/ydr8mjcd4_z1snyrs0hzrd840000gn/T/pip-record-axfypb45/install-record.txt --single-version-externally-managed --compile --install-headers /Library/Frameworks/Python.framework/Versions/3.10/include/python3.10/scipy
             cwd: /private/var/folders/dm/ydr8mjcd4_z1snyrs0hzrd840000gn/T/pip-install-swd6xkjh/scipy_53c3cdd4e8e2447f841731b3161ea9a3/
        Complete output (107 lines):
        /private/var/folders/dm/ydr8mjcd4_z1snyrs0hzrd840000gn/T/pip-install-swd6xkjh/scipy_53c3cdd4e8e2447f841731b3161ea9a3/setup.py:114: DeprecationWarning: the imp module is deprecated in favour of importlib and slated for removal in Python 3.12; see the module's documentation for alternative uses
          import imp
        
        Note: if you need reliable uninstall behavior, then install
        with pip instead of using `setup.py install`:
        
          - `pip install .`       (from a git repo or downloaded source
                                   release)
          - `pip install scipy`   (last SciPy release on PyPI)
        
        
        Running from scipy source directory.
        lapack_opt_info:
        lapack_mkl_info:
        customize UnixCCompiler
          libraries mkl_rt not found in ['/Library/Frameworks/Python.framework/Versions/3.10/lib', '/usr/local/lib', '/usr/lib']
          NOT AVAILABLE
        
        openblas_lapack_info:
          libraries openblas not found in ['/Library/Frameworks/Python.framework/Versions/3.10/lib', '/usr/local/lib', '/usr/lib']
          NOT AVAILABLE
        
        openblas_clapack_info:
          libraries openblas,lapack not found in ['/Library/Frameworks/Python.framework/Versions/3.10/lib', '/usr/local/lib', '/usr/lib']
          NOT AVAILABLE
        
        flame_info:
          libraries flame not found in ['/Library/Frameworks/Python.framework/Versions/3.10/lib', '/usr/local/lib', '/usr/lib']
          NOT AVAILABLE
        
        accelerate_info:
          NOT AVAILABLE
        
        atlas_3_10_threads_info:
        Setting PTATLAS=ATLAS
          libraries lapack_atlas not found in /Library/Frameworks/Python.framework/Versions/3.10/lib
          libraries tatlas,tatlas not found in /Library/Frameworks/Python.framework/Versions/3.10/lib
          libraries lapack_atlas not found in /usr/local/lib
          libraries tatlas,tatlas not found in /usr/local/lib
          libraries lapack_atlas not found in /usr/lib
          libraries tatlas,tatlas not found in /usr/lib
        <class 'numpy.distutils.system_info.atlas_3_10_threads_info'>
          NOT AVAILABLE
        
        atlas_3_10_info:
          libraries lapack_atlas not found in /Library/Frameworks/Python.framework/Versions/3.10/lib
          libraries satlas,satlas not found in /Library/Frameworks/Python.framework/Versions/3.10/lib
          libraries lapack_atlas not found in /usr/local/lib
          libraries satlas,satlas not found in /usr/local/lib
          libraries lapack_atlas not found in /usr/lib
          libraries satlas,satlas not found in /usr/lib
        <class 'numpy.distutils.system_info.atlas_3_10_info'>
          NOT AVAILABLE
        
        atlas_threads_info:
        Setting PTATLAS=ATLAS
          libraries lapack_atlas not found in /Library/Frameworks/Python.framework/Versions/3.10/lib
          libraries ptf77blas,ptcblas,atlas not found in /Library/Frameworks/Python.framework/Versions/3.10/lib
          libraries lapack_atlas not found in /usr/local/lib
          libraries ptf77blas,ptcblas,atlas not found in /usr/local/lib
          libraries lapack_atlas not found in /usr/lib
          libraries ptf77blas,ptcblas,atlas not found in /usr/lib
        <class 'numpy.distutils.system_info.atlas_threads_info'>
          NOT AVAILABLE
        
        atlas_info:
          libraries lapack_atlas not found in /Library/Frameworks/Python.framework/Versions/3.10/lib
          libraries f77blas,cblas,atlas not found in /Library/Frameworks/Python.framework/Versions/3.10/lib
          libraries lapack_atlas not found in /usr/local/lib
          libraries f77blas,cblas,atlas not found in /usr/local/lib
          libraries lapack_atlas not found in /usr/lib
          libraries f77blas,cblas,atlas not found in /usr/lib
        <class 'numpy.distutils.system_info.atlas_info'>
          NOT AVAILABLE
        
        lapack_info:
          libraries lapack not found in ['/Library/Frameworks/Python.framework/Versions/3.10/lib', '/usr/local/lib', '/usr/lib']
          NOT AVAILABLE
        
        /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/numpy/distutils/system_info.py:1858: UserWarning:
            Lapack (http://www.netlib.org/lapack/) libraries not found.
            Directories to search for the libraries can be specified in the
            numpy/distutils/site.cfg file (section [lapack]) or by setting
            the LAPACK environment variable.
          return getattr(self, '_calc_info_{}'.format(name))()
        lapack_src_info:
          NOT AVAILABLE
        
        /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/numpy/distutils/system_info.py:1858: UserWarning:
            Lapack (http://www.netlib.org/lapack/) sources not found.
            Directories to search for the sources can be specified in the
            numpy/distutils/site.cfg file (section [lapack_src]) or by setting
            the LAPACK_SRC environment variable.
          return getattr(self, '_calc_info_{}'.format(name))()
          NOT AVAILABLE
        
        Traceback (most recent call last):
          File "<string>", line 1, in <module>
          File "/private/var/folders/dm/ydr8mjcd4_z1snyrs0hzrd840000gn/T/pip-install-swd6xkjh/scipy_53c3cdd4e8e2447f841731b3161ea9a3/setup.py", line 492, in <module>
            setup_package()
          File "/private/var/folders/dm/ydr8mjcd4_z1snyrs0hzrd840000gn/T/pip-install-swd6xkjh/scipy_53c3cdd4e8e2447f841731b3161ea9a3/setup.py", line 488, in setup_package
            setup(**metadata)
          File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/numpy/distutils/core.py", line 135, in setup
            config = configuration()
          File "/private/var/folders/dm/ydr8mjcd4_z1snyrs0hzrd840000gn/T/pip-install-swd6xkjh/scipy_53c3cdd4e8e2447f841731b3161ea9a3/setup.py", line 395, in configuration
            raise NotFoundError(msg)
        numpy.distutils.system_info.NotFoundError: No lapack/blas resources found. Note: Accelerate is no longer supported.
        ----------------------------------------
    ERROR: Command errored out with exit status 1: /Library/Frameworks/Python.framework/Versions/3.10/bin/python3.10 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/dm/ydr8mjcd4_z1snyrs0hzrd840000gn/T/pip-install-swd6xkjh/scipy_53c3cdd4e8e2447f841731b3161ea9a3/setup.py'"'"'; __file__='"'"'/private/var/folders/dm/ydr8mjcd4_z1snyrs0hzrd840000gn/T/pip-install-swd6xkjh/scipy_53c3cdd4e8e2447f841731b3161ea9a3/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/dm/ydr8mjcd4_z1snyrs0hzrd840000gn/T/pip-record-axfypb45/install-record.txt --single-version-externally-managed --compile --install-headers /Library/Frameworks/Python.framework/Versions/3.10/include/python3.10/scipy Check the logs for full command output.

不太确定出了什么问题,但我认为 Python 在说我没有安装 BLAS 和 LAPACK 库,但我已经使用 Homebrew 安装了 openblas 和 lapack 后仍然遇到相同的错误。我不明白错误日志告诉我的是什么。

我使用的是 macOS Big Sur 操作系统,在一台配备 Core i9 处理器的 2019 年款 MacBook Pro 16 英寸型号上。


看起来你需要先安装 numpy - chickity china chinese chicken
你可能想使用Anaconda,它包括NumPy、SciPy和其他数据科学库。 - wjandrea
https://stackoverflow.com/search?q=%5Bpip%5D+%5Bscipy%5D+Python+3.10 - phd
请查看我另一个答案的说明。 - Mikko Ohtamaa
1个回答

6

我想这是由于Scipy还没有支持Python 3.10,因此尝试在该版本的Python中安装它应该会在某个地方失败。

考虑使用较低版本的Python,或者像一个用户建议的那样使用Anaconda。另外,如果你有时间,可以等待Scipy开发人员发布兼容版本(似乎他们正在解决相关问题)。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接