如何在Windows 8.1中的Anaconda(python3.6)中将cython pyx编译为pyd? [英] How to build cython pyx to pyd in anaconda(python3.6) in windows 8.1?
问题描述
我已经推荐一些网站在Windows 8.1中将pyx编译为pyd。我正在将Anaconda Distribution与Spyder IDE结合使用,我已经开发了pyx文件,但无法在 Anaconda Command Prompt
Anaconda中进行编译> p>
I have referred some websites to build pyx to pyd in Windows 8.1.I 'm using Anaconda Distribution with Spyder IDE, I have developed pyx file and unable to build in "Anaconda Command Prompt" Anaconda>
python setup.py build --inplace --compiler=mingw32
并尝试
python setup.py build_ext --inplace --compiler=mingw32
出现以下错误:
File "C:\ProgramData\Anaconda3\lib\distutils\cygwinccompiler.py", line 129 in __init__
if self.ld_version >= "2.10.90":
TypeError: '>=' not supported between instances of 'NoneType' and 'str'
$实例之间不支持b $ b
我的简单pyx代码是
my simple pyx code is
cdef int fib(int n):
cdef int a, b, i
a, b = 1, 1
for i in range(n):
a, b = a+b, a
return a
和我的setup.py文件
and my setup.py file as below..
from distutils.core import setup
from Cython.Build import cythonize
setup(ext_modules = cythonize('fb.pyx'))
如何摆脱这种情况Windows 8.1?我想在套接字编程中使用Struct和Socket库。
Howto get rid of this in windows 8.1? I would like use Struct and Socket libraries for my socket programming.
推荐答案
.pyx或setup.py代码没有错亚太地区。
我在Windows 10上使用Anaconda3,它可以工作。
There's nothing wrong with your .pyx or setup.py code AFAICT. I am using Anaconda3 on windows 10 and it works.
问题出在编译器上。您自己安装了mingw32吗?
看来无论您使用的哪个版本都无法编译代码。
对于cygwin我也遇到了同样的错误
The issue is with the compiler. Did you install mingw32 yourself? It looks like whichever version you have cannot compile the code. I got the same error for cygwin
但是,使用Visual Studio 14中包含的编译器和borlands编译器对我来说,代码编译正常。
But, the code compiled fine for me using the compiler included in Visual Studio 14 and the borlands compiler.
尝试--compiler = bcpp(希望已在您的系统上)
Try --compiler=bcpp (hopefully already be on your system)
或
尝试安装: http://landinghub.visualstudio.com/ visual-cpp-build-tools
并使用--compiler = msvc(或仅不指定编译器)运行您的编译命令。
Try installing: http://landinghub.visualstudio.com/visual-cpp-build-tools and run your compile command with --compiler=msvc (or just without specifying the compiler.)
这篇关于如何在Windows 8.1中的Anaconda(python3.6)中将cython pyx编译为pyd?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!