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

前端之家收集整理的这篇文章主要介绍了无法在Windows 10上使用python2.7/MINGW安装pyslalib软件包前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在尝试在Windows 10上使用python 2.7安装 pyslalib package并继续获取以下内容

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

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

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

谢谢,

输出错误是:

C:\Python27\libs/libpython27.a(dmmes01026.o):(.idata$7+0x0): undefined reference to `_head_C__build27_cpython_PCBuild_libpython27_a'
C:\Python27\libs/libpython27.a(dmmes00281.o):(.idata$7+0x0): undefined reference to `_head_C__build27_cpython_PCBuild_libpython27_a'
C:\Python27\libs/libpython27.a(dmmes00105.o):(.idata$7+0x0): undefined reference to `_head_C__build27_cpython_PCBuild_libpython27_a'
C:\Python27\libs/libpython27.a(dmmes00253.o):(.idata$7+0x0): undefined reference to `_head_C__build27_cpython_PCBuild_libpython27_a'
C:\Python27\libs/libpython27.a(dmmes00227.o):(.idata$7+0x0): undefined reference to `_head_C__build27_cpython_PCBuild_libpython27_a'
C:\Python27\libs/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:\python22\libs\ (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.

原文链接:https://www.f2er.com/windows/372012.html

猜你在找的Windows相关文章