简体   繁体   English

无法在 cygwin 或 dos 命令提示符下使用 Python 3.2 和 MinGW32 安装 Cython

[英]Cannot install Cython with Python 3.2 and MinGW32 under cygwin or under dos comandprompt

I am trying to install Cython 0.14 on my Windows 7, 32 bit, coupled with Python 3.2.我正在尝试在我的 Windows 7 32 位上安装 Cython 0.14,再加上 Python 3.2。 I followed the instructions given at http://wiki.cython.org/InstallingOnWindows , but have run into several deadends.我按照http://wiki.cython.org/InstallingOnWindows给出的说明进行操作,但遇到了几个死角。 I think the I have followed the instruction for MinGW exactly, except for the part about opening prompt and test if I have installed MinGW correctly (How do I test that?).我认为我完全遵循了 MinGW 的说明,除了关于打开提示和测试我是否正确安装了 MinGW 的部分(我该如何测试?)。

I first ran into some errors when I tried installing Cython by typing当我尝试通过键入安装 Cython 时,我首先遇到了一些错误

python setup.py install

in cygwin, but I resolved those.在cygwin中,但我解决了这些。 However, my python 3.2 still didn't know of the existence of Cython, so I tracked to problem down to cython being installed under c:\cygwin\lib\ while python is installed under c:\python32. However, my python 3.2 still didn't know of the existence of Cython, so I tracked to problem down to cython being installed under c:\cygwin\lib\ while python is installed under c:\python32. So I tried various methods of moving cython to python folder, but since I didn't know where exactly everything goes, those attempts did not come to fruition.因此,我尝试了各种将 cython 移动到 python 文件夹的方法,但由于我不知道所有内容的确切位置,这些尝试并没有实现。

In the interim, I tried to look for different, faster interpreters of python, and installed pypy.在此期间,我尝试寻找不同的、更快的 python 解释器,并安装了 pypy。 I also reinstalled python 3.2 to clear out the mess I made by trying to install cython in the python directory.我还重新安装了 python 3.2 以清除我尝试在 python 目录中安装 cython 造成的混乱。

Then later I tried to install cython again using the command prompt, with the same script, but found that the default version of python has changed to 2.6, which probably sneaked in with the failed cython installations.后来我尝试使用命令提示符再次安装 cython,使用相同的脚本,但发现 python 的默认版本已更改为 2.6,这可能是由于 cython 安装失败而潜入的。 But finding that python 2.6 can't compile the setup.py file, I just did但是发现python 2.6 无法编译setup.py文件,我刚做了

c:\python32\python setup.py install

in the cython directory.在 cython 目录中。 This worked until it gave me an error这一直有效,直到它给了我一个错误

TypeError: NoneType() is Unordered: if self.gcc_version <= "2.91.57":

in the distutils.cygwinccompiler module in python32.在 python32 的 distutils.cygwinccompiler 模块中。 So I changed that to所以我把它改成了

if (not self.gcc_version == None) and self.gcc_version <= "2.91.57":

When I tried installing again under the command prompt, I get this error:当我尝试在命令提示符下再次安装时,出现此错误:

running build
running build_py
running build_ext
Access is denied.
skipping 'C:\cython-0.14.1\Cython\Plex\Scanners.c' Cython extension (up-to-date)

building 'Cython.Plex.Scanners' extension
C:\cygwin\bin\gcc.exe -mno-cygwin -mdll -O -Wall -IC:\Python32\include -IC:\Pyth
on32\PC -c C:\cython-0.14.1\Cython\Plex\Scanners.c -o c:\cython-0.14.1\cython\pl
ex\scanners.o
error: command 'gcc' failed: Permission denied

I tried the same thing with cygwin and I get the same error.我用cygwin尝试了同样的事情,我得到了同样的错误。 I have restarted my computer and tried again, still same error.我已经重新启动计算机并再次尝试,仍然是同样的错误。

Any and all help would be appreciated, since I spent an entire day on this to no avail.任何和所有的帮助将不胜感激,因为我花了一整天的时间无济于事。

See Get "Access is denied" when trying to compile with g++ from command line. 尝试从命令行使用 g++ 进行编译时,请参阅获取“访问被拒绝”。 Cygwin . 赛格温 This fully addresses your question.这完全解决了您的问题。 The issue is apparently symlinks (as i learnt today much to my discomfiture).问题显然是符号链接(正如我今天学到的很多让我感到不安的东西)。

The "Permission denied" is still a good way to look. “Permission denied”仍然是一个很好的查看方式。 It can happen because:它可能发生,因为:

  1. the gcc command is not executable (weird, but are you able to type "gcc --version" and get the output?) gcc 命令不可执行(很奇怪,但你能输入“gcc --version”并得到 output 吗?)
  2. the destination path "c:\cython-0.14.1\cython\plex\" is not available or not writable.目标路径“c:\cython-0.14.1\cython\plex\”不可用或不可写。 If you have install it with administration right and use with user right, maybe it's the case.如果您以管理权限安装它并以用户权限使用,也许就是这样。 Try to give access to everyone here.尝试让这里的每个人都可以访问。 (disclamer: i'm not a windows guy ^^) (免责声明:我不是 windows 的家伙^^)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM