Python中文
首页
教程
问答
标签
搜索
登录
注册
编译python扩展modu时的链接错误
回答此问题可获得
20
贡献值,回答如果被采纳可获得
50
分。
<p>所以我用C编写了一个python扩展模块,并试图为我的64位python构建编译它。在我的头撞了MinGW一段时间后,我做了一些搜索,发现MIWW不做64位扩展模块,所以我用Wi7SDK和DItStudisIUsSDK和MSDK都设置了VisualC++ 2008的Express,这两个表达式都等于1,如在{{A1}的答案中一样。</p> <p>我终于找到了Distutils来查找编译器,但是当我编译扩展时,得到了以下输出:</p> <pre><code>core.obj : error LNK2019: unresolved external symbol __imp__PyErr_NoMemory refer enced in function "int __cdecl handleErrors(int)" (?handleErrors@@YAHH@Z) core.obj : error LNK2019: unresolved external symbol __imp__PyErr_SetString refe renced in function "int __cdecl handleErrors(int)" (?handleErrors@@YAHH@Z) core.obj : error LNK2019: unresolved external symbol _opus_encoder_destroy refer enced in function "void __cdecl OpusEncoder_dealloc(struct OpusEncoderObject *)" (?OpusEncoder_dealloc@@YAXPAUOpusEncoderObject@@@Z) core.obj : error LNK2019: unresolved external symbol __imp__Py_BuildValue refere nced in function "int __cdecl OpusEncoder_init(struct OpusEncoderObject *,struct _object *,struct _object *)" (?OpusEncoder_init@@YAHPAUOpusEncoderObject@@PAU_o bject@@1@Z) core.obj : error LNK2019: unresolved external symbol _opus_encoder_create refere nced in function "int __cdecl OpusEncoder_init(struct OpusEncoderObject *,struct _object *,struct _object *)" (?OpusEncoder_init@@YAHPAUOpusEncoderObject@@PAU_o bject@@1@Z) core.obj : error LNK2019: unresolved external symbol __imp__PyArg_ParseTupleAndK eywords referenced in function "int __cdecl OpusEncoder_init(struct OpusEncoderO bject *,struct _object *,struct _object *)" (?OpusEncoder_init@@YAHPAUOpusEncode rObject@@PAU_object@@1@Z) core.obj : error LNK2019: unresolved external symbol __imp__PyTuple_Pack referen ced in function "struct _object * __cdecl OpusEncoder_encode(struct OpusEncoderO bject *,struct _object *)" (?OpusEncoder_encode@@YAPAU_object@@PAUOpusEncoderObj ect@@PAU1@@Z) core.obj : error LNK2019: unresolved external symbol __imp__PyString_FromString referenced in function "struct _object * __cdecl OpusEncoder_encode(struct OpusE ncoderObject *,struct _object *)" (?OpusEncoder_encode@@YAPAU_object@@PAUOpusEnc oderObject@@PAU1@@Z) core.obj : error LNK2019: unresolved external symbol _opus_encode_float referenc ed in function "struct _object * __cdecl OpusEncoder_encode(struct OpusEncoderOb ject *,struct _object *)" (?OpusEncoder_encode@@YAPAU_object@@PAUOpusEncoderObje ct@@PAU1@@Z) core.obj : error LNK2019: unresolved external symbol __imp__PyFloat_AsDouble ref erenced in function "struct _object * __cdecl OpusEncoder_encode(struct OpusEnco derObject *,struct _object *)" (?OpusEncoder_encode@@YAPAU_object@@PAUOpusEncode rObject@@PAU1@@Z) core.obj : error LNK2019: unresolved external symbol __imp__PyType_IsSubtype ref erenced in function "struct _object * __cdecl OpusEncoder_encode(struct OpusEnco derObject *,struct _object *)" (?OpusEncoder_encode@@YAPAU_object@@PAUOpusEncode rObject@@PAU1@@Z) core.obj : error LNK2019: unresolved external symbol __imp__PyFloat_Type referen ced in function "struct _object * __cdecl OpusEncoder_encode(struct OpusEncoderO bject *,struct _object *)" (?OpusEncoder_encode@@YAPAU_object@@PAUOpusEncoderObj ect@@PAU1@@Z) core.obj : error LNK2019: unresolved external symbol _opus_encode referenced in function "struct _object * __cdecl OpusEncoder_encode(struct OpusEncoderObject * ,struct _object *)" (?OpusEncoder_encode@@YAPAU_object@@PAUOpusEncoderObject@@PA U1@@Z) core.obj : error LNK2019: unresolved external symbol __imp__PyErr_Occurred refer enced in function "struct _object * __cdecl OpusEncoder_encode(struct OpusEncode rObject *,struct _object *)" (?OpusEncoder_encode@@YAPAU_object@@PAUOpusEncoderO bject@@PAU1@@Z) core.obj : error LNK2019: unresolved external symbol __imp__PyInt_AsLong referen ced in function "struct _object * __cdecl OpusEncoder_encode(struct OpusEncoderO bject *,struct _object *)" (?OpusEncoder_encode@@YAPAU_object@@PAUOpusEncoderObj ect@@PAU1@@Z) core.obj : error LNK2019: unresolved external symbol __imp__PyArg_ParseTuple ref erenced in function "struct _object * __cdecl OpusEncoder_encode(struct OpusEnco derObject *,struct _object *)" (?OpusEncoder_encode@@YAPAU_object@@PAUOpusEncode rObject@@PAU1@@Z) core.obj : error LNK2019: unresolved external symbol __imp__PyModule_AddObject r eferenced in function _initopys core.obj : error LNK2019: unresolved external symbol __imp__PyErr_NewException r eferenced in function _initopys core.obj : error LNK2019: unresolved external symbol __imp__Py_InitModule4 refer enced in function _initopys core.obj : error LNK2019: unresolved external symbol __imp__PyType_Ready referen ced in function _initopys core.obj : error LNK2019: unresolved external symbol __imp__PyType_GenericNew re ferenced in function _initopys core.obj : error LNK2019: unresolved external symbol __imp__Py_Initialize refere nced in function _main core.obj : error LNK2019: unresolved external symbol __imp__Py_SetProgramName re ferenced in function _main build\lib.win-amd64-2.7\opys.pyd : fatal error LNK1120: 23 unresolved externals error: command '"C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\link. exe"' failed with exit status 1120 </code></pre> <p>我头撞了三天的墙,有什么建议吗?</p>
0 条评论
分类:
Python问答
请先
登录
后评论
默认排序
时间排序
1 个回答
匿名
1天前
擅长:python、mysql、java
<p>我也犯了同样的错误。从<a href="https://github.com/nwcell/psycopg2-windows" rel="nofollow">https://github.com/nwcell/psycopg2-windows</a>安装psycopg2解决了我的问题</p>
请先
登录
后评论
针对此问题:
更多的回答
关注
89
关注
收藏
1
收藏,
216
浏览
网友 提问于 2天前
相关Python问题
无法使用Django/mongoengine连接到MongoDB(身份验证失败)
2 回答
无法使用Django\u mssql\u后端迁移到外部hos
7 回答
无法使用Django&Python3.4连接到MySql
1 回答
无法使用Django+nginx上载媒体文件
3 回答
无法使用Django1.6导入名称模式
5 回答
无法使用Django1.7和mongodb登录管理站点
6 回答
无法使用Djangoadmin创建项目,进程使用了错误的路径,因为我事先安装了错误的Python
3 回答
无法使用Djangockedi验证CBV中的字段
7 回答
无法使用Djangocketditor上载图像(错误400)
9 回答
无法使用Djangocron进行函数调用
9 回答
无法使用Djangofiler djang上载文件
9 回答
无法使用Djangokronos
8 回答
无法使用Djangomssql provid
4 回答
无法使用Djangomssql连接到带有Django 1.11的MS SQL Server 2016
6 回答
无法使用Djangomssq迁移Django数据库
1 回答
无法使用Djangonox创建用户
1 回答
无法使用Djangopyodb从Django查询SQL Server
8 回答
无法使用Djangopython3ldap连接到ldap
3 回答
无法使用Djangoredis连接到redis
6 回答
无法使用Django中的FK创建新表
4 回答