我正在尝试在OSX 10.10.3 Yosemite上安装Link Grammar Python绑定。我直接从解压缩的下载目录(link-grammar-5.3.7)运行以下命令:
./configure --enable-python-bindings
但我收到此错误:
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.
============================================================================
结果,我试图通过运行locate pymath.h
找出我的 python 库路径在哪里:
/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/pymath.h
/System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/pymath.h
/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/pymath.h
/anaconda/envs/py27/include/python2.7/pymath.h
/anaconda/include/python3.5m/pymath.h
/anaconda/pkgs/python-2.7.11-0/include/python2.7/pymath.h
/anaconda/pkgs/python-3.5.1-0/include/python3.5m/pymath.h
/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/include/python2.7/pymath.h
对于上下文,which python
返回 /Library/Frameworks/Python.framework/Versions/2.7/bin/python
。
然后我尝试使用这些路径中的每一个运行 ./configure,例如:
./configure --enable-python-bindings LDFLAGS="-L/anaconda/pkgs/python-2.7.11-0/include/python2.7
每次,我要么得到与上面相同的错误,要么C compiler cannot create executables
.
我试图按照"安装 Python 包的开发版本"的说明进行操作,但了解到"我不需要 python-devel",并尝试运行brew uninstall python; brew install python
由于这篇文章。
没有--enable-python-bindings
./configure
运行良好,所以问题出在 python 上。
有人对如何创建这些 python 绑定有任何建议吗?谢谢!
在LDFLAGS中,你必须使用libpython库的位置。如果需要,可以使用以下命令指定包含文件的位置:
CPPFLAGS="-I/path/of/include-directory"
您可能会在 GitHub 上的链接语法存储库的问题 #298 中找到一些关于下一步操作的提示。
如果仍有问题,请考虑在那里打开问题。