Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/sockets/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 3.x 如何在windows 8.1中的anaconda(python3.6)中将cython pyx构建为pyd?_Python 3.x_Sockets_Struct_Cython_Cythonize - Fatal编程技术网

Python 3.x 如何在windows 8.1中的anaconda(python3.6)中将cython pyx构建为pyd?

Python 3.x 如何在windows 8.1中的anaconda(python3.6)中将cython pyx构建为pyd?,python-3.x,sockets,struct,cython,cythonize,Python 3.x,Sockets,Struct,Cython,Cythonize,我参考了一些网站在Windows 8.1中构建pyx到pyd。我正在使用带有Spyder IDE的Anaconda发行版,我已经开发了pyx文件,无法在“Anaconda命令提示符”中构建 水蟒> python setup.py build --inplace --compiler=mingw32 并尝试 python setup.py build_ext --inplace --compiler=mingw32 获取以下错误: File "C:\ProgramData\Anaconda3

我参考了一些网站在Windows 8.1中构建pyx到pyd。我正在使用带有Spyder IDE的Anaconda发行版,我已经开发了pyx文件,无法在“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'
我的简单pyx代码是

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文件,如下所示

from distutils.core import setup
from Cython.Build import cythonize

setup(ext_modules = cythonize('fb.pyx'))

如何在windows 8.1中消除此问题?我想在套接字编程中使用Struct和Socket库。

您的.pyx或setup.py代码AFAICT没有问题。 我在windows 10上使用Anaconda3,它可以工作

问题在于编译器。您自己安装了mingw32吗? 看起来无论您使用哪个版本都无法编译代码。 我对cygwin也犯了同样的错误

但是,使用VisualStudio14中包含的编译器和borlands编译器编译的代码对我来说很好

Try--compiler=bcpp(希望已经在您的系统上)

尝试安装: 并使用--compiler=msvc(或者不指定编译器)运行compile命令