使用– LDFLAGS的Python链接不起作用

问题描述 投票:2回答:1

我遇到了麻烦:“无法将测试程序链接到Python。”

我在/Library/Frameworks/中安装了2.7+版本。

我已经尝试过this solution,但是由于它发布超过6年,所以它没有考虑SIP(系统完整性保护),这使许多用户无法更改System/Library文件。另外,在更高版本的Python中,Python的make文件中的PYTHONFRAMEWORKDIRPYTHONFRAMEWORKINSTALLDIR已修复(但问题仍然存在)。

我尝试过:

  • ./configure PYTHON_LDFLAGS="-l2.7.13_1"
  • ./configure LDFLAGS="-L/usr/local/Cellar/python/2.7.13_1/lib"

…但是似乎没有LDFLAGS的组合起作用。

这里是错误:

Could not link test program to Python. Maybe the main Python library has been
  installed in some non-standard library path. If so, pass it to configure,
  via the LDFLAGS environment variable.
  Example: ./configure LDFLAGS="-L/usr/non-standard-path/python/lib"
  ============================================================================
   ERROR!
   You probably have to install the development version of the Python package
   for your distribution.  The exact name of this package varies among them.
  ============================================================================ 

这是日志说明:

PKG_CONFIG=''
PYTHON='/Library/Frameworks/Python.framework/Versions/2.7/bin/python'
PYTHON_CPPFLAGS='-I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7'
PYTHON_EXEC_PREFIX='${exec_prefix}'
PYTHON_EXTRA_LDFLAGS='-u _PyMac_Error Python.framework/Versions/2.7/Python'
PYTHON_EXTRA_LIBS='-ldl  -framework CoreFoundation '
PYTHON_LDFLAGS='-L/Library/Frameworks/Python.framework/Versions/2.7/lib -lpython2.7'
PYTHON_PLATFORM='darwin'
PYTHON_PREFIX='${prefix}'
PYTHON_SITE_PKG='/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages'
PYTHON_VERSION='2.7'

如何将Python从系统中剔除?那有必要吗?或是否有解决此错误的方法?

python homebrew pocketsphinx
1个回答
0
投票

在我的机器上有同样的错误输出,对我来说,它有助于安装python-dev,所以

sudo apt-get install python-dev

为我做了。

© www.soinside.com 2019 - 2024. All rights reserved.