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

标签 python windows numpy pip virtualenv

在 Windows 上,我通常只使用二进制安装程序,但我想安装 NumPy这次只在virtualenv中,所以我创建了一个virtual 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 二进制文件安装到一个具有良好 'ol easy_install 和一 pip 解档魔法的虚拟环境中。

您从 SourceForge 下载的 numpy-1.x.x-win32-superpack-python2.x.exe 版本实际上只是围绕三个单独的二进制发行版的薄包装器(有 SSE3SSE2 或未启用 SSE,具体取决于 CPU 的功能)。如果你打开 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)。如果您有 reasonably modern processor (比 Pentium 4Athlon 64 更新),使用完整的 SSE3 可能是安全的。您可能还可以运行测试套件以确认一切正常。


我发现 easy_install “技巧”对于将各种二进制包安装到 virtualenv 中非常有用。尽管我在我的机器上设置了所有必需的编译器,但如果提供了官方版本,通常更容易/更快/更安全。

关于python - Windows + virtualenv + pip + NumPy(安装 NumPy 时出现问题),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6114115/

相关文章:

windows - 如何递归地将特定模式的文件复制到 Windows 上的单个平面文件夹中?

python - 如何使用 Python 在 Windows 应用程序中获取右键单击上下文菜单?

python - Python 中的线与线相交与 numpy

Numpy:带负轴的 np.sum

python - Pymongo 不在 mongodb 中创建集合

python - 使用 optparse 接受参数的大多数 pythonic 方式

python - TensorFlow:一个网络,两个 GPU?

python - 使用数据框将列数据显示为单独的列

windows - 有什么方法可以用 OllyDbg 调试 .COM 文件吗?

python - Python OpenCV OCR数字数组未按for循环顺序打印