Python链接使用 - LDFLAGS不起作用

时间:2017-07-25 09:00:18

标签: python homebrew pocketsphinx

我遇到了麻烦:“无法将测试程序链接到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从我的系统中删除?这有必要吗?或者是否修复了此错误?

1 个答案:

答案 0 :(得分:0)

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

sudo apt-get install python-dev

是我帮忙的。