Windows上的SciPy与Python 2.7安装问题

时间:2016-08-21 00:39:24

标签: python windows python-2.7 windows-7 scipy

想知道是否有人遇到类似问题并且已经有解决方案了吗?使用Windows 7。

C:\Python27\Scripts>pip install SciPy
Collecting SciPy
  Using cached scipy-0.18.0.tar.gz
Installing collected packages: SciPy
  Running setup.py install for SciPy ... error
    Complete output from command c:\python27\python.exe -u -c "import setuptools
, tokenize;__file__='c:\\users\\foo\\appdata\\local\\temp\\pip-build-r3jpxr\\
SciPy\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().r
eplace('\r\n', '\n'), __file__, 'exec'))" install --record c:\users\foo\appda
ta\local\temp\pip-efo9to-record\install-record.txt --single-version-externally-m
anaged --compile:

    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)


    lapack_opt_info:
    openblas_lapack_info:
      libraries openblas not found in ['c:\\python27\\lib', 'C:\\', 'c:\\python2
7\\libs']
      NOT AVAILABLE

    lapack_mkl_info:
    mkl_info:
      libraries mkl,vml,guide not found in ['c:\\python27\\lib', 'C:\\', 'c:\\py
thon27\\libs']
      NOT AVAILABLE

      NOT AVAILABLE

    atlas_3_10_threads_info:
    Setting PTATLAS=ATLAS
    c:\python27\lib\site-packages\numpy\distutils\system_info.py:639: UserWarnin
g: Specified path C:\projects\windows-wheel-builder\atlas-builds\atlas-3.11.38-s
se2-64\lib is invalid.
      warnings.warn('Specified path %s is invalid.' % d)
    <class 'numpy.distutils.system_info.atlas_3_10_threads_info'>
      NOT AVAILABLE

    atlas_3_10_info:
    <class 'numpy.distutils.system_info.atlas_3_10_info'>
      NOT AVAILABLE

    atlas_threads_info:
    Setting PTATLAS=ATLAS
    <class 'numpy.distutils.system_info.atlas_threads_info'>
      NOT AVAILABLE

    atlas_info:
    <class 'numpy.distutils.system_info.atlas_info'>
      NOT AVAILABLE

    c:\python27\lib\site-packages\numpy\distutils\system_info.py:1548: UserWarni
ng:
        Atlas (http://math-atlas.sourceforge.net/) libraries not found.
        Directories to search for the libraries can be specified in the
        numpy/distutils/site.cfg file (section [atlas]) or by setting
        the ATLAS environment variable.
      warnings.warn(AtlasNotFoundError.__doc__)
    lapack_info:
      libraries lapack not found in ['c:\\python27\\lib', 'C:\\', 'c:\\python27\
\libs']
      NOT AVAILABLE

    c:\python27\lib\site-packages\numpy\distutils\system_info.py:1559: UserWarni
ng:
        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.
      warnings.warn(LapackNotFoundError.__doc__)
    lapack_src_info:
      NOT AVAILABLE

    c:\python27\lib\site-packages\numpy\distutils\system_info.py:1562: UserWarni
ng:
        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.
      warnings.warn(LapackSrcNotFoundError.__doc__)
      NOT AVAILABLE

    Running from scipy source directory.
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "c:\users\foo\appdata\local\temp\pip-build-r3jpxr\SciPy\setup.py",
 line 415, in <module>
        setup_package()
      File "c:\users\foo\appdata\local\temp\pip-build-r3jpxr\SciPy\setup.py",
 line 411, in setup_package
        setup(**metadata)
      File "c:\python27\lib\site-packages\numpy\distutils\core.py", line 135, in
 setup
        config = configuration()
      File "c:\users\foo\appdata\local\temp\pip-build-r3jpxr\SciPy\setup.py",
 line 335, in configuration
        config.add_subpackage('scipy')
      File "c:\python27\lib\site-packages\numpy\distutils\misc_util.py", line 10
03, in add_subpackage
        caller_level = 2)
      File "c:\python27\lib\site-packages\numpy\distutils\misc_util.py", line 97
2, in get_subpackage
        caller_level = caller_level + 1)
      File "c:\python27\lib\site-packages\numpy\distutils\misc_util.py", line 90
9, in _get_configuration_from_setup_py
        config = setup_module.configuration(*args)
      File "scipy\setup.py", line 15, in configuration
        config.add_subpackage('linalg')
      File "c:\python27\lib\site-packages\numpy\distutils\misc_util.py", line 10
03, in add_subpackage
        caller_level = 2)
      File "c:\python27\lib\site-packages\numpy\distutils\misc_util.py", line 97
2, in get_subpackage
        caller_level = caller_level + 1)
      File "c:\python27\lib\site-packages\numpy\distutils\misc_util.py", line 90
9, in _get_configuration_from_setup_py
        config = setup_module.configuration(*args)
      File "scipy\linalg\setup.py", line 20, in configuration
        raise NotFoundError('no lapack/blas resources found')
    numpy.distutils.system_info.NotFoundError: no lapack/blas resources found

    ----------------------------------------
Command "c:\python27\python.exe -u -c "import setuptools, tokenize;__file__='c:\
\users\\foo\\appdata\\local\\temp\\pip-build-r3jpxr\\SciPy\\setup.py';exec(co
mpile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __
file__, 'exec'))" install --record c:\users\foo\appdata\local\temp\pip-efo9to
-record\install-record.txt --single-version-externally-managed --compile" failed
 with error code 1 in c:\users\foo\appdata\local\temp\pip-build-r3jpxr\SciPy\

编辑1 ,尝试了pip install scipy-0.18.0-cp27-cp27m-win_amd64.whl,但遇到了一些奇怪的问题,

C:\Python27\Scripts>pip install scipy-0.18.0-cp27-cp27m-win_amd64.whl
Requirement 'scipy-0.18.0-cp27-cp27m-win_amd64.whl' looks like a filename, but t
he file does not exist
Processing c:\python27\scripts\scipy-0.18.0-cp27-cp27m-win_amd64.whl
Exception:
Traceback (most recent call last):
  File "c:\python27\lib\site-packages\pip\basecommand.py", line 215, in main
    status = self.run(options, args)
  File "c:\python27\lib\site-packages\pip\commands\install.py", line 299, in run

    requirement_set.prepare_files(finder)
  File "c:\python27\lib\site-packages\pip\req\req_set.py", line 370, in prepare_
files
    ignore_dependencies=self.ignore_dependencies))
  File "c:\python27\lib\site-packages\pip\req\req_set.py", line 587, in _prepare
_file
    session=self.session, hashes=hashes)
  File "c:\python27\lib\site-packages\pip\download.py", line 798, in unpack_url
    unpack_file_url(link, location, download_dir, hashes=hashes)
  File "c:\python27\lib\site-packages\pip\download.py", line 705, in unpack_file
_url
    unpack_file(from_path, location, content_type, link)
  File "c:\python27\lib\site-packages\pip\utils\__init__.py", line 599, in unpac
k_file
    flatten=not filename.endswith('.whl')
  File "c:\python27\lib\site-packages\pip\utils\__init__.py", line 482, in unzip
_file
    zipfp = open(filename, 'rb')
IOError: [Errno 2] No such file or directory: 'C:\\Python27\\Scripts\\scipy-0.18
.0-cp27-cp27m-win_amd64.whl'

1 个答案:

答案 0 :(得分:5)

某些软件包(如Scipy)需要使用pip构建编译器。 Windows不附带编译器,因此您需要下载Windows可以使用的scipy二进制文件。

来自加州大学欧文分校的一位名叫克里斯托弗·戈尔克的精彩男子为窗户开发了这些二进制文件。你可以找到它们here

注意:如果您没有安装Numpy,则无法安装SciPy。您还需要下载Numpy Binary(也找到here)。只需按照后续步骤下载numpy模块,就像下载scipy模块一样。

您安装的链接取决于您是否具有64位或32位版本的python,如果已将其安装到PATH上,则可以在命令行上使用python命令进行检查。这是可视化的:

C:\Users\Bobby>python
Python 2.7.11 (v2.7.11:6d1b6a68f775, Dec  5 2015, 20:40:30) [MSC v.1500 64 bit (AMD64)] on win32

您可以在括号中找到您的版本。如您所见,我正在运行64位版本的python。所以我会下载“scipy-0.18.0-cp27-cp27m-win_amd64.whl”文件,该文件假设我在64位版本的python上运行python 2.7(由cp27表示)(由amd64表示)。

注意:还要确保更新pip。您可以使用以下命令更新它:

C:\Users\Bobby\Downloads>pip install --upgrade pip

下载SciPy二进制文件后,将工作目录更改为下载文件夹并运行pip,但在下载中使用.whl文件。这是可视化的:

C:\Users\Bobby>cd Downloads
C:\Users\Bobby\Downloads>pip install scipy-0.18.0-cp27-cp27m-win_amd64.whl
Processing c:\users\bobby\downloads\scipy-0.18.0-cp27-cp27m-win_amd64.whl
Installing collected packages: scipy
Successfully installed scipy-0.18.0