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

在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二进制文件安装到具有良好的'ol easy_install和一点未归档魔术的虚拟环境中。

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

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

在Python和C++之间传输数据而无需写入Windows和Unix文件 - python

我有预先存在的python和C ++文件,其中python文件定义了许多点,而C ++代码利用其现有库进行了所需的计算。最终产品是C ++代码写入的文件。我正在寻找一种在python中获取2000点列表的方法,将其传递给函数,然后执行所有C ++代码并输出我需要的文件。其他注意事项。这必须是可以在Linux或Windows机器上工作的东西,并且最少安装新插件…

扩展Python时可以使用C++功能吗? - c++

Python手册说您可以在C和C++中为Python创建模块。使用C++时可以利用类和模板之类的东西吗?它不会与其他库和解释器产生不兼容吗? 参考方案 挂钩函数的实现是用C还是用C++实现都没有关系。实际上,我已经看过一些Python扩展,这些扩展有效利用C++模板甚至Boost库。没问题。 :-)

将Python嵌入C++应用程序 - c++

上下文:我们一直面临的一个持续问题是对我们的市场数据应用程序进行单元测试。这些应用程序坐下来观察从提要中检索到的数据并执行某些操作。一些很难触发的关键事件很少发生,并且测试人员很难在所有情况下验证我们的应用程序是否正常运行,因此我们必须依靠单元测试。这些系统通常通过在事件发生时发出回调(进入我们的应用程序)来工作,然后由我们负责处理此事件。 我设想的解决方案…

在Java中,执行“ ++++++++”表达式,编译器未报告任何错误并且可以正确执行? - java

我用eclipse编写了这段代码,用war写过,结果为3d。public static void main(String[] args) { double a = 5d + + + + + +-+3d; System.out.println(a); } 参考方案 您的表情可以改写为(5d) + (+ + + + +-+3d) 其中第一个+是应用于两个操作数的…

从C++调用Python函数 - c++

我正在尝试从C++实现调用Python函数。我以为可以通过函数指针来实现,但是似乎不可能。我一直在使用boost.python完成此操作。假设在Python中定义了一个函数:def callback(arg1, arg2): #do something return something 现在,我需要将此函数传递给C++,以便可以从那里调用它。如何使用boos…