ICode9

精准搜索请尝试: 精确搜索
首页 > 系统相关> 文章详细

使Cython在Anacondas,Windows 7 64位上与Python 3.4一起使用

2019-11-20 14:58:17  阅读:315  来源: 互联网

标签:anaconda cython mingw python


我刚刚使用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,然后使用该文件进行编译.

标签:anaconda,cython,mingw,python
来源: https://codeday.me/bug/20191120/2044851.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有