本文介绍了安装Cython时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在Windows 8.1中安装了SimpleCV 1.3 powerpack.然后,我设置所需的路径.然后我通过cmd安装了pyreadline,PIL,pip,ipython.但是,当我尝试运行easy_install cython时,出现以下错误,

I have installed SimpleCV 1.3 powerpack in my Windows 8.1. Then i set up the required path. And then i installed pyreadline, PIL, pip, ipython via cmd. But when i tried to run easy_install cython, i'm getting the following error,

C:\Users\Ankit>easy_install Cython
Searching for Cython
Reading http://pypi.python.org/simple/Cython/
Best match: Cython 0.22
Downloading https://pypi.python.org/packages/source/C/Cython/Cython-0.22.tar.gz#
md5=1ae25add4ef7b63ee9b4af697300d6b6
Processing Cython-0.22.tar.gz
Running Cython-0.22\setup.py -q bdist_egg --dist-dir c:\users\ankit\appdata\local
\temp\easy_install-lvjvzj\Cython-0.22\egg-dist-tmp-aeuxtq
Unable to find pgen, not compiling formal grammar.
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.Tempita._tempita ...
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 '*.pxd' under directory 'Cython\Utility'
Scanners.c
C:\Python27\include\pyconfig.h(227) : fatal error C1083: Cannot open include   file: 'basetsd.h': No such fil
e or directory
error: Setup script exited with error: command '"C:\Program Files (x86)\Microsof
t Visual Studio 9.0\VC\BIN\cl.exe"' failed with exit status 2

请帮帮我.

推荐答案

我正在使用Windows8/Xubuntu14.04LTS双分区系统.尝试install Cython onto Xubuntu via pip时,我遇到了同样的问题.

I'm using a double partition system Windows8/Xubuntu14.04LTS.I had the same issue when attempting to install Cython onto Xubuntu via pip.

因此,我使用以下命令安装了Cython,一切正常.

So I installed Cython with below command and and everything went ok.

bashsh $ sudo apt-get install cython

这不是最佳解决方案.但是,如果您确实是希望将几乎完整的项目移植到Windows8.

This is not the best fix. But, may worth a trial if you are reallylooking to port an almost complete project to Windows8.

您编译Python主程序(不包含主程序):

You compile your Python main (without main):

bash $ cython --embed -o prog.c prog.py

您可以决定执行install Mxe (MingW) gcc on linux并执行交叉编译,或者像我一样直接在Windows8中进行编译:

You may decide to install Mxe (MingW) gcc on linux and docross compiling or, as me, to compile directly in the windows8:

bash $ gcc -Os -IC:\Python27\include -LC:\Python27\libs -o prog.exe prog.c -lpython27 -DMS_WIN64

希望这可能有帮助.

这篇关于安装Cython时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-18 20:45