当前位置: 首页 > 面试题库 >

Windows + virtualenv + pip + NumPy(安装NumPy时出现问题)

逑禄
2023-03-14
问题内容

在Windows上,我通常只使用二进制安装程序,但是这次我只想在virtualenv中安装NumPy,因此我创建了一个虚拟env:

virtualenv --no-site-packages --distribute summary_python
cd summary_python/Scripts
activate.bat

然后我尝试安装NumPy

pip install numpy

我得到一个错误。我的pip.log粘贴在下面:

Downloading/unpacking numpy
  Running setup.py egg_info for package numpy
    non-existing path in 'numpy\\distutils': 'site.cfg'
    F2PY Version 2
    blas_opt_info:
    blas_mkl_info:
      libraries mkl,vml,guide not found in c:\Users\fname.lname\Documents\summary_python\lib
      libraries mkl,vml,guide not found in C:\
      NOT AVAILABLE

    atlas_blas_threads_info:
    Setting PTATLAS=ATLAS
      libraries ptf77blas,ptcblas,atlas not found in c:\Users\fname.lname\Documents\summary_python\lib
      libraries ptf77blas,ptcblas,atlas not found in C:\
      NOT AVAILABLE

    atlas_blas_info:
      libraries f77blas,cblas,atlas not found in c:\Users\fname.lname\Documents\summary_python\lib
      libraries f77blas,cblas,atlas not found in C:\
      NOT AVAILABLE

    blas_info:
      libraries blas not found in c:\Users\fname.lname\Documents\summary_python\lib
      libraries blas not found in C:\
      NOT AVAILABLE

    blas_src_info:
      NOT AVAILABLE

      NOT AVAILABLE

    lapack_opt_info:
    lapack_mkl_info:
    mkl_info:
      libraries mkl,vml,guide not found in c:\Users\fname.lname\Documents\summary_python\lib
      libraries mkl,vml,guide not found in C:\
      NOT AVAILABLE

      NOT AVAILABLE

    atlas_threads_info:
    Setting PTATLAS=ATLAS
      libraries ptf77blas,ptcblas,atlas not found in c:\Users\fname.lname\Documents\summary_python\lib
      libraries lapack_atlas not found in c:\Users\fname.lname\Documents\summary_python\lib
      libraries ptf77blas,ptcblas,atlas not found in C:\
      libraries lapack_atlas not found in C:\
    numpy.distutils.system_info.atlas_threads_info
      NOT AVAILABLE

    atlas_info:
      libraries f77blas,cblas,atlas not found in c:\Users\fname.lname\Documents\summary_python\lib
      libraries lapack_atlas not found in c:\Users\fname.lname\Documents\summary_python\lib
      libraries f77blas,cblas,atlas not found in C:\
      libraries lapack_atlas not found in C:\
    numpy.distutils.system_info.atlas_info
      NOT AVAILABLE

    lapack_info:
      libraries lapack not found in c:\Users\fname.lname\Documents\summary_python\lib
      libraries lapack not found in C:\
      NOT AVAILABLE

    lapack_src_info:
      NOT AVAILABLE

      NOT AVAILABLE

    running egg_info
    running build_src
    build_src
    building py_modules sources
    building library "npymath" sources
    No module named msvccompiler in numpy.distutils; trying from distutils
    Running from numpy source directory.c:\Users\fname.lname\Documents\summary_python\build\numpy\numpy\distutils\system_info.py:531: UserWarning: Specified path  is invalid.
      warnings.warn('Specified path %s is invalid.' % d)
    c:\Users\fname.lname\Documents\summary_python\build\numpy\numpy\distutils\system_info.py:1417: UserWarning:
        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__)
    c:\Users\fname.lname\Documents\summary_python\build\numpy\numpy\distutils\system_info.py:1426: UserWarning:
        Blas (http://www.netlib.org/blas/) libraries not found.
        Directories to search for the libraries can be specified in the
        numpy/distutils/site.cfg file (section [blas]) or by setting
        the BLAS environment variable.
      warnings.warn(BlasNotFoundError.__doc__)
    c:\Users\fname.lname\Documents\summary_python\build\numpy\numpy\distutils\system_info.py:1429: UserWarning:
        Blas (http://www.netlib.org/blas/) sources not found.
        Directories to search for the sources can be specified in the
        numpy/distutils/site.cfg file (section [blas_src]) or by setting
        the BLAS_SRC environment variable.
      warnings.warn(BlasSrcNotFoundError.__doc__)
    c:\Users\fname.lname\Documents\summary_python\build\numpy\numpy\distutils\system_info.py:1333: UserWarning:
        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__)
    c:\Users\fname.lname\Documents\summary_python\build\numpy\numpy\distutils\system_info.py:1344: 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.
      warnings.warn(LapackNotFoundError.__doc__)
    c:\Users\fname.lname\Documents\summary_python\build\numpy\numpy\distutils\system_info.py:1347: 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.
      warnings.warn(LapackSrcNotFoundError.__doc__)
    error: Unable to find vcvarsall.bat
    Complete output from command python setup.py egg_info:
    non-existing path in 'numpy\\distutils': 'site.cfg'

F2PY Version 2

blas_opt_info:

blas_mkl_info:

  libraries mkl,vml,guide not found in c:\Users\fname.lname\Documents\summary_python\lib

  libraries mkl,vml,guide not found in C:\

  NOT AVAILABLE



atlas_blas_threads_info:

Setting PTATLAS=ATLAS

  libraries ptf77blas,ptcblas,atlas not found in c:\Users\fname.lname\Documents\summary_python\lib

  libraries ptf77blas,ptcblas,atlas not found in C:\

  NOT AVAILABLE



atlas_blas_info:

  libraries f77blas,cblas,atlas not found in c:\Users\fname.lname\Documents\summary_python\lib

  libraries f77blas,cblas,atlas not found in C:\

  NOT AVAILABLE



blas_info:

  libraries blas not found in c:\Users\fname.lname\Documents\summary_python\lib

  libraries blas not found in C:\

  NOT AVAILABLE



blas_src_info:

  NOT AVAILABLE



  NOT AVAILABLE



lapack_opt_info:

lapack_mkl_info:

mkl_info:

  libraries mkl,vml,guide not found in c:\Users\fname.lname\Documents\summary_python\lib

  libraries mkl,vml,guide not found in C:\

  NOT AVAILABLE



  NOT AVAILABLE



atlas_threads_info:

Setting PTATLAS=ATLAS

  libraries ptf77blas,ptcblas,atlas not found in c:\Users\fname.lname\Documents\summary_python\lib

  libraries lapack_atlas not found in c:\Users\fname.lname\Documents\summary_python\lib

  libraries ptf77blas,ptcblas,atlas not found in C:\

  libraries lapack_atlas not found in C:\

numpy.distutils.system_info.atlas_threads_info

  NOT AVAILABLE



atlas_info:

  libraries f77blas,cblas,atlas not found in c:\Users\fname.lname\Documents\summary_python\lib

  libraries lapack_atlas not found in c:\Users\fname.lname\Documents\summary_python\lib

  libraries f77blas,cblas,atlas not found in C:\

  libraries lapack_atlas not found in C:\

numpy.distutils.system_info.atlas_info

  NOT AVAILABLE



lapack_info:

  libraries lapack not found in c:\Users\fname.lname\Documents\summary_python\lib

  libraries lapack not found in C:\

  NOT AVAILABLE



lapack_src_info:

  NOT AVAILABLE



  NOT AVAILABLE



running egg_info

running build_src

build_src

building py_modules sources

building library "npymath" sources

No module named msvccompiler in numpy.distutils; trying from distutils

Running from numpy source directory.c:\Users\fname.lname\Documents\summary_python\build\numpy\numpy\distutils\system_info.py:531: UserWarning: Specified path  is invalid.

  warnings.warn('Specified path %s is invalid.' % d)

c:\Users\fname.lname\Documents\summary_python\build\numpy\numpy\distutils\system_info.py:1417: UserWarning:

    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__)

c:\Users\fname.lname\Documents\summary_python\build\numpy\numpy\distutils\system_info.py:1426: UserWarning:

    Blas (http://www.netlib.org/blas/) libraries not found.

    Directories to search for the libraries can be specified in the

    numpy/distutils/site.cfg file (section [blas]) or by setting

    the BLAS environment variable.

  warnings.warn(BlasNotFoundError.__doc__)

c:\Users\fname.lname\Documents\summary_python\build\numpy\numpy\distutils\system_info.py:1429: UserWarning:

    Blas (http://www.netlib.org/blas/) sources not found.

    Directories to search for the sources can be specified in the

    numpy/distutils/site.cfg file (section [blas_src]) or by setting

    the BLAS_SRC environment variable.

  warnings.warn(BlasSrcNotFoundError.__doc__)

c:\Users\fname.lname\Documents\summary_python\build\numpy\numpy\distutils\system_info.py:1333: UserWarning:

    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__)

c:\Users\fname.lname\Documents\summary_python\build\numpy\numpy\distutils\system_info.py:1344: 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.

  warnings.warn(LapackNotFoundError.__doc__)

c:\Users\fname.lname\Documents\summary_python\build\numpy\numpy\distutils\system_info.py:1347: 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.

  warnings.warn(LapackSrcNotFoundError.__doc__)

error: Unable to find vcvarsall.bat

----------------------------------------
Command python setup.py egg_info failed with error code 1
Exception information:
Traceback (most recent call last):
  File "c:\Users\fname.lname\Documents\summary_python\lib\site-packages\pip-1.0.1-py2.7.egg\pip\basecommand.py", line 126, in main
    self.run(options, args)
  File "c:\Users\fname.lname\Documents\summary_python\lib\site-packages\pip-1.0.1-py2.7.egg\pip\commands\install.py", line 223, in run
    requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
  File "c:\Users\fname.lname\Documents\summary_python\lib\site-packages\pip-1.0.1-py2.7.egg\pip\req.py", line 986, in prepare_files
    req_to_install.run_egg_info()
  File "c:\Users\fname.lname\Documents\summary_python\lib\site-packages\pip-1.0.1-py2.7.egg\pip\req.py", line 222, in run_egg_info
    command_desc='python setup.py egg_info')
  File "c:\Users\fname.lname\Documents\summary_python\lib\site-packages\pip-1.0.1-py2.7.egg\pip\__init__.py", line 255, in call_subprocess
    % (command_desc, proc.returncode))
InstallationError: Command python setup.py egg_info failed with error code 1

问题答案:

我已经成功地将NumPy二进制文件安装到具有良好的’oleasy_install和一点未归档魔术的虚拟环境中。

numpy-1.x.x-win32-superpack- python2.x.exe您从SourceForge下载的发行版实际上只是三个独立的二进制发行版的薄包装(根据您的CPU功能,启用SSE3,SSE2或不启用SSE)。如果您在7-Zip(或另一个存档实用程序)中打开superpack
EXE文件,则可以将这些单独的安装文件提取到某个地方以单独使用。

然后,激活您的虚拟环境并运行

easy_install c:\path\to\extracted\numpy-1.x.x-sse3.exe

例如,安装经过SSE3优化的二进制文件。easy_install非常聪明,可以在wininst捆绑包中找到它所需的一切,并将已编译的egg提取到您的virtualenv的site-
packages文件夹中。我还可以确认,当您执行此操作时,pip仍然能够识别和/或卸载NumPy,并且使用pip安装其他依赖于NumPy的软件包也可以。

唯一的困难是知道要使用哪个优化级别(SSE3,SSE2或否-
SSE)。如果您有一个相当现代的处理器(比奔腾4或Athlon
64更新),那么使用完整的SSE3可能是安全的。您可能还可以运行测试套件以确认一切正常。

我发现easy_install“技巧”对于将各种二进制程序包安装到virtualenv中非常有用。即使我的机器上已经安装了所有必需的编译器,但提供官方版本时,通常更容易/更快/更安全



 类似资料:
  • 我下载了Python 3.6.1,它预装了Pip。我写了这个命令来安装Numpy 我得到了这个作为输出: 收集Numpy无法获取URLhttps://pypi.python.org/simple/numpy/:确认ssl证书时出现问题:[SSL:CERTIFICATE_VERIFY_FAILED]证书验证失败(_ssl. c: 749)-跳过无法找到满足要求的版本Numpy(来自版本:)麻木 我如

  • 问题内容: 我根本无法在Windows上安装NumPy。我不断收到此错误- 我之前有Python 64位版本,但不确定NumPy版本是否与64位Python兼容。因此,我将其卸载并安装了32位Python版本。但是我仍然遇到相同的错误。虽然我的Python 32位版本运行正常。 我尝试了“ pip install numpy”,但最后却给我以下错误- 请告诉我我可能做错了什么。 问题答案: 一些解

  • 问题内容: 我想使用命令安装numpy,但出现以下错误: 我正在使用Windows 7 32位,python 2.7.9,pip 6.1.1和一些MSVC编译器。我认为它使用Visual C ++ 2010 Express中的编译器,但实际上我不确定是哪个版本,因为我安装了多个Visual Studio。 我知道有用于Windows的预编译软件包,但是我想弄清楚是否有某种方法可以通过键入? 编辑:

  • 我试图在我正在分发的包中创建所需的库。它需要SciPy和NumPy库。在开发过程中,我使用 它安装了SciPy 0.9。0和NumPy 1.5。1,而且效果很好。 我想使用-执行同样的操作,以便能够在设置中指定依赖项。我自己的包裹。 问题是,当我尝试时: 它很好用。 但是 惨败 我如何让它工作?

  • 问题内容: 我正在尝试在要分发的程序包中创建所需的库。它需要SciPy和NumPy库。在开发过程中,我同时使用 它安装了SciPy 0.9.0和NumPy 1.5.1,并且运行良好。 我想使用-做同样的事情,以便能够在我自己的包的setup.py中指定依赖项。 问题是,当我尝试: 它工作正常。 但是之后 惨败 我该如何工作? 问题答案: 我假设我的回答是Linux经验。我发现要顺利进行有三个先决条

  • 问题内容: 我发现在64位Windows上无法通过安装程序安装NumPy / SciPy,只有在32位上才可以。因为我需要的内存比32位安装提供的内存更多,所以我需要所有内容的64位版本。 我试图通过安装所有东西,并且大多数事情都起作用了。但是当我来到SciPy时,它抱怨缺少一个Fortran编译器。所以我通过MinGW / MSYS安装了Fortran。但是之后,您不能立即安装SciPy,需要重