在Windows 7下使用python 3.3(Anaconda)构建最小的cython文件 [英] Building minimal cython file with python 3.3 (Anaconda) under windows 7

查看:114
本文介绍了在Windows 7下使用python 3.3(Anaconda)构建最小的cython文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试在Windows 7下使用Python 3.3(Anaconda 3)构建最小的Cython文件test.pyx时,出现一个奇怪的错误:

When I try to build a minimal Cython file test.pyx with Python 3.3 (Anaconda 3) under windows 7, I obtain a strange error:

C:\Users\myname\Test_cython>python setup.py build
running build
running build_ext
error: [WinError 2] The system cannot find the file specified

当然test.pyx在工作目录中.在Windows下使用Python 2.7(Anaconda)以及在Linux下使用Python 2和3都可以正常工作.

Of course test.pyx is in the working directory. It works fine under windows with Python 2.7 (Anaconda) and under Linux with Python 2 and 3.

Python 3.3(Anaconda 3)在这里可能是什么问题?

What could be the problem here with Python 3.3 (Anaconda 3)?

谢谢

文件setup.py:

The file setup.py:

from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext

setup(
    name = 'test',
    cmdclass = {"build_ext": build_ext},
    ext_modules = [Extension('test', ['test.pyx'])]
    )

解决方案:

我发现软件包utils的文件cygwinccompiler.py的第404行

I found that the line 404 of the file cygwinccompiler.py of the package disutils

out_string = check_output(['gcc', '-dumpmachine'])

必须更改为

out_string = check_output(['gcc', '-dumpmachine'], shell=True)

然后,它可以正常编译.

Then, it compiles normally.

推荐答案

disutils包的文件cygwinccompiler.py的第404行

The line 404 of the file cygwinccompiler.py of the package disutils

out_string = check_output(['gcc', '-dumpmachine'])

必须更改为

out_string = check_output(['gcc', '-dumpmachine'], shell=True)

然后,它可以正常编译.

Then, it compiles normally.

这篇关于在Windows 7下使用python 3.3(Anaconda)构建最小的cython文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆