使Cython在Anacondas,Windows 7 64位上与Python 3.4一起使用
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了使Cython在Anacondas,Windows 7 64位上与Python 3.4一起使用,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含1764字,纯文字阅读大概需要3分钟。
内容图文
我刚刚使用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一起使用全部内容,希望文章能够帮你解决使Cython在Anacondas,Windows 7 64位上与Python 3.4一起使用所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。