Python Cython安装错误

Python Cython安装错误,python,cython,Python,Cython,运行easy\u install Cython时出错: C:\Users\Hp>cd C:\Python27\Scripts C:\Python27\Scripts>easy_install Cython Searching for Cython Reading http://pypi.python.org/simple/Cython/ Best match: Cython 0.19.1 Downloading https://pypi.python.org/packages/so

运行easy\u install Cython时出错:

C:\Users\Hp>cd C:\Python27\Scripts

C:\Python27\Scripts>easy_install Cython
Searching for Cython
Reading http://pypi.python.org/simple/Cython/
Best match: Cython 0.19.1
Downloading https://pypi.python.org/packages/source/C/Cython/Cython-0.19.1.zip
d5=991e7887140b3e962ef65e9c05a8694d
Processing Cython-0.19.1.zip
Running Cython-0.19.1\setup.py -q bdist_egg --dist-dir c:\users\hp\appdata\loc
\temp\easy_install-jfquni\Cython-0.19.1\egg-dist-tmp-yxdubl
Compiling module Cython.Plex.Scanners ...
Compiling module Cython.Plex.Actions ...
Compiling module Cython.Compiler.Lexicon ...
Compiling module Cython.Compiler.Scanning ...
Compiling module Cython.Compiler.Parsing ...
Compiling module Cython.Compiler.Visitor ...
Compiling module Cython.Compiler.FlowControl ...
Compiling module Cython.Compiler.Code ...
Compiling module Cython.Runtime.refnanny ...
warning: no files found matching '*.pyx' under directory 'Cython\Debugger\Test

warning: no files found matching '*.pxd' under directory 'Cython\Debugger\Test

warning: no files found matching '*.h' under directory 'Cython\Debugger\Tests'
warning: no files found matching '*.pxd' under directory 'Cython\Utility'
error: Setup script exited with error: Unable to find vcvarsall.bat

我收到了这个错误,显然需要一些开发文件。我不知道如何在windows上获得它?

我在vcvarsall.bat上遇到了同样的问题,我为windows 8和Python 3.4解决这个问题的步骤是:

关于Cython的安装,有两种选择:从第一步开始或直接跳到第二步:

第一步

不使用pip安装Cython:

我从这里下载了我版本的.whl:

然后我安装了.whl,这样做:

pip install filename.whl
这样,cython就不会抱怨vcvarshall.bat了

现在您将安装Cython,由于这一点,您将能够创建c代码,但它会给.pyd的创建带来问题,并且一旦您开始编译代码,它将显示与vcvarshall.bat丢失之前相同的错误。这就是为什么第二步需要它

第二步

  • 安装MinGW

  • 转到C:\Python34\Lib\distutils\

    创建文件distutils.cfg并写入:

    [build]
    compiler = mingw32
    
  • 添加到您的路径C:\MinGW\bin

  • 现在,您可以重新安装.whl或直接从以下位置安装Cython: pip安装cython

  • 每当您尝试呼叫cython时,它仍可能会给您一个错误:

       zlib1.dll was not found
    
  • 从这里下载即可:

  • 提取文件夹并将zlib1.dll复制粘贴到C:\MinGW\bin中

  • 现在Cython应该可以正常工作了

    此外,我在一些帖子中读到建议说,解决方案是安装MVS 2008,但它已被弃用,因此我不建议使用此选项

    此解决方案是我找到的多个答案的组合,我一直在尝试,直到得到正确的解决方案,我附加了链接,以防您想查看其他解决方案或观点:


    我的病毒检测程序刚刚将refnanny.pyd标记为病毒并将其清除。显然,它触发了某种启发式匹配

    您是否安装了编译器?
    找不到vcvarsall.bat
    清楚地表明您的系统正在寻找VisualC的编译器。我建议安装MinGW,并按此处所述操作: