加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Windows > 正文

无法在Windows 10上使用python2.7/MINGW安装pyslalib软件包

发布时间:2020-12-13 20:38:56 所属栏目:Windows 来源:网络整理
导读:我正在尝试在Windows 10上使用python 2.7安装 pyslalib package并继续获取以下内容: “collect2.exe:错误:ld返回1退出状态” 我尝试运行“python setup.py install”时的错误消息.我认为这可能是我的mingw配置的一个问题,但我似乎找不到问题. 任何有关此
我正在尝试在Windows 10上使用python 2.7安装 pyslalib package并继续获取以下内容:

“collect2.exe:错误:ld返回1退出状态”

我尝试运行“python setup.py install”时的错误消息.我认为这可能是我的mingw配置的一个问题,但我似乎找不到问题.

任何有关此问题的帮助将不胜感激.周末大部分时间我都在吃饭.

谢谢,

输出错误是:

C:Python27libs/libpython27.a(dmmes01026.o):(.idata$7+0x0): undefined reference to `_head_C__build27_cpython_PCBuild_libpython27_a'
C:Python27libs/libpython27.a(dmmes00281.o):(.idata$7+0x0): undefined reference to `_head_C__build27_cpython_PCBuild_libpython27_a'
C:Python27libs/libpython27.a(dmmes00105.o):(.idata$7+0x0): undefined reference to `_head_C__build27_cpython_PCBuild_libpython27_a'
C:Python27libs/libpython27.a(dmmes00253.o):(.idata$7+0x0): undefined reference to `_head_C__build27_cpython_PCBuild_libpython27_a'
C:Python27libs/libpython27.a(dmmes00227.o):(.idata$7+0x0): undefined reference to `_head_C__build27_cpython_PCBuild_libpython27_a'
C:Python27libs/libpython27.a(dmmes00712.o):(.idata$7+0x0): more undefined references to `_head_C__build27_cpython_PCBuild_libpython27_a' follow
collect2.exe: error: ld returned 1 exit status
这看起来像我最近遇到的问题.我认为Python中包含的libpython27.a存在问题(我的版本是2.7.10).根据发现 here的说明从python27.dll创建我自己的libpython27.a修复了问题.

To create Python extensions,you need to link against the Python
library. Unfortunately,most Python distributions are provided with
Python22.lib,a library in Microsoft Visual C++ format. GCC expects a
.a file (libpython22.a to be precise.). Here’s how to convert
python22.lib to libpython22.a:

  1. Download pexport (from here or
    07001).
  2. Get
    Python22.dll (it should be somewhere on your harddrive).
  3. Run :
    pexports python22.dll > python22.def This will extract all symbols
    from python22.dll and write them into python22.def.
  4. Run : dlltool --dllname python22.dll --def python22.def --output-lib libpython22.a This will create libpython22.a (dlltool is part of MinGW utilities).
  5. Copy libpython22.a to c:python22libs (in the same directory as
    python22.lib).

This trick should work for all Python versions,including future releases of Python. You can also use this trick to convert other libraries.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读