others - 如何解决:"Testing pyext configuration : Could not build python extensions"

我正在尝试安装wxPython,但是 wheel 构建失败,


Machine: Linux on Power (this is not x86)


OS: RHEL Server, 7.5 (Maipo)


python version: Python 3.6.4


pip3 version: pip 19.3.1




<...>


 Finished command: build_wx (1m56.907s)


 Running command: build_py


 Checking for /tmp/pip-req-build-dgnp13sp/bin/waf-2.0.8...


"/afs/apd.pok.ibm.com/u/mfacchin/wxenvlop/bin/python3" /tmp/pip-req-build-dgnp13sp/bin/waf-2.0.8 --wx_config=/tmp/pip-req-build-dgnp13sp/build/wxbld/gtk3/wx-config --gtk3 --python="/afs/apd.pok.ibm.com/u/mfacchin/wxenvlop/bin/python3" --out=build/waf/3.6/gtk3 configure build


 Setting top to : /tmp/pip-req-build-dgnp13sp


 Setting out to : /tmp/pip-req-build-dgnp13sp/build/waf/3.6/gtk3


 Checking for 'gcc' (C compiler) : /bin/gcc


 Checking for 'g++' (C++ compiler) : /bin/g++


 Checking for program 'python' : /afs/apd.pok.ibm.com/u/mfacchin/wxenvlop/bin/python3


 Checking for python version >= 2.7.0 : 3.6.4


 python-config : /opt/xsite/cte/tools/python/3.6/bin/python3.6-config


 Asking python-config for pyext '--cflags --libs --ldflags' flags : yes


 Testing pyext configuration : Could not build python extensions


 The configuration failed


 (complete log in /tmp/pip-req-build-dgnp13sp/build/waf/3.6/gtk3/config.log)


 Command '"/afs/apd.pok.ibm.com/u/mfacchin/wxenvlop/bin/python3" /tmp/pip-req-build-dgnp13sp/bin/waf-2.0.8 --wx_config=/tmp/pip-req-build-dgnp13sp/build/wxbld/gtk3/wx-config --gtk3 --python="/afs/apd.pok.ibm.com/u/mfacchin/wxenvlop/bin/python3" --out=build/waf/3.6/gtk3 configure build ' failed with exit code 1.


 Finished command: build_py (0m6.991s)


 Finished command: build (2m3.899s)


 Command '"/afs/apd.pok.ibm.com/u/mfacchin/wxenvlop/bin/python3" -u build.py build' failed with exit code 1.


 Building wheel for wxPython (setup.py): finished with status 'error'


 ERROR: Failed building wheel for wxPython


<...>



时间:

看来你可能正在使用自定义Python构建,你的python是使用 --enable-shared配置选项? 在Linux平台上,waf构建工具假定Python是按这种方式构建的,并且将尝试与Python共享库链接,如果不存在,它将失败。

如果这没有帮助,那么你可以从waf的配置日志中获得更多的细节,当使用pip进行构建时,它将删除临时构建文件夹,然后才能访问它们。 因此,如果你解压源代码归档,使用python3 build.py build进行构建,你将在 ./build/waf/3.6/gtk3/config.log 发现一些有用的线索。

...