我刚刚使用Anaconda / Condas在Windows 7 64位计算机上安装了Python 3.4.当我运行“hello world” cython example时,出现此错误:[py34] C:\Users\Jon\Documents\GitHub\CythonFunctions\cython_funcspython setup...

我刚刚使用Anaconda / Condas在Windows 7 64位计算机上安装了Python 3.4.
当我运行“hello world” cython example时,出现此错误:
[py34] C:\Users\Jon\Documents\GitHub\CythonFunctions\cython_funcs>python setup.py build_ext --inplace
running build_ext
building 'cython_funcs.hello' extension
C:\Anaconda\envs\py34\MinGW\bin\gcc.exe -mdll -O -Wall -IC:\Anaconda\envs\py34\include -IC:\Anaconda\envs\py34\include -c hello.c -o build\temp.win-amd64-3.4\Release\hello.o
writing build\temp.win-amd64-3.4\Release\hello.def
C:\Anaconda\envs\py34\MinGW\bin\gcc.exe -shared -s build\temp.win-amd64-3.4\Release\hello.o build\temp.win-amd64-3.4\Release\hello.def -LC:\Anaconda\envs\py34\libs -LC:\Anaconda\envs\py34\PCbuild\amd6
4 -lpython34 -lmsvcr100 -o C:\Users\Jon\Documents\GitHub\CythonFunctions\cython_funcs\cython_funcs\hello.pyd
build\temp.win-amd64-3.4\Release\hello.o:hello.c:(.text+0x314): undefined reference to `__imp__PyThreadState_Current'
build\temp.win-amd64-3.4\Release\hello.o:hello.c:(.text+0x493): undefined reference to `__imp__Py_NoneStruct'
build\temp.win-amd64-3.4\Release\hello.o:hello.c:(.text+0x97b): undefined reference to `__imp_PyExc_ImportError'
collect2.exe: error: ld returned 1 exit status
error: command 'C:\\Anaconda\\envs\\py34\\MinGW\\bin\\gcc.exe' failed with exit status 1
通过搜索stackoverflow和google,当gcc和python版本不是32位或64位时,都会发生此错误.
我检查过我的Python是64位.从下面的路径可以看到,我拥有的MinGW是我的Python安装的一部分.如何检查它是否为64位?还是此错误可能是由于其他原因引起的?
更新:
奇怪的是,这里的Ipython cythonmagic命令可以正常工作:
http://docs.cython.org/src/quickstart/build.html?highlight=cythonmagic
解决方法:
一种方法是conda删除libpython(这将导致distutils不使用mingw),然后安装Visual Studio 2010,然后使用该文件进行编译.
本文标题为:使Cython在Anacondas,Windows 7 64位上与Python 3.4一起使用


基础教程推荐
- OpenCV+MediaPipe实现手部关键点识别 2023-08-11
- windows中python2与python3共存 2023-09-03
- 基于Python实现股票数据分析的可视化 2023-08-04
- Pygame库200行代码实现简易飞机大战 2023-08-04
- php-Python子进程无法识别$PATH中的命令 2023-11-11
- Python:Windows下更改Python源至清华镜像源 2023-11-11
- python 内置函数-range()+zip()+sorted()+map()+reduce()+filter() 2023-08-09
- Python+Flask实现自定义分页的示例代码 2022-10-20
- Python办公自动化之Excel介绍 2023-08-09
- python-没有空闲子进程连接 2023-11-10