[英]Building graph-tool on OSX with Python 3.4
I tried to install graph-tool on Mac OSX 10.10 using homebrew. 我尝试使用自制软件在Mac OSX 10.10上安装图形工具。 The brew build process works fine, but when I try to import graph-tool I get the error described in this question . brew构建过程工作正常,但是当我尝试导入图形工具时,我得到了这个问题中描述的错误 。 Another problem with homebrew is that I always builds graph-tool for python2.7 and it installs the packages in the Python 2.7 sit-packages folder. 自制软件的另一个问题是我总是为python2.7构建图形工具,并将软件包安装在Python 2.7 sit-packages文件夹中。 But I want to use it with Python 3.4. 但我想在Python 3.4中使用它。 These are the reasons why I tried to build graph-tool from source. 这些是我尝试从源代码构建图形工具的原因。
The ./configure
command automatically uses Python 2.7, too. ./configure
命令也自动使用Python 2.7。 So I passed it the desired Python version with ./configure PYTHON=python3.4
所以我用./configure PYTHON=python3.4
传递了所需的Python版本
It then detects the correct version as well as the related paths but crash with the following error: 然后它会检测正确的版本以及相关路径,但会因以下错误而崩溃:
configure: error: 配置:错误:
Could not link test program to Python. 无法将测试程序链接到Python。 Maybe the main Python library has been installed in some non-standard library path. 也许主要的Python库已经安装在一些非标准的库路径中。 If so, pass it to configure, via the LDFLAGS environment variable. 如果是,请通过LDFLAGS环境变量将其传递给configure。
Example: ./configure LDFLAGS="-L/usr/non-standard-path/python/lib" 示例:./ 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. 您可能必须为您的发行版安装Python包的开发版本。 The exact name of this package varies among them. 这个包的确切名称因其而异。
====================================================================== ================================================== ====================
The error occurs with and without PYTHON
variable set. 使用和不使用PYTHON
变量时会发生错误。 From the output of ./configure
I can see that everything works fine except for the last line, which says: 从./configure
的输出我可以看到一切正常,除了最后一行,它说:
checking consistency of all components of python development environment... no 检查python开发环境的所有组件的一致性...没有
Whats does the above line mean and how do I properly install graph-tool on my maschine? 上述行是什么意思,我如何在我的机器上正确安装图形工具?
The error message is explaining exactly what needs to be done. 该错误消息说明需要做什么 。 Since python was installed in a non-standard path, you need to pass the flag LDFLAGS="-L/usr/non-standard-path/python/lib"
pointing to the directory where the python libraries are located. 由于python安装在非标准路径中,因此需要传递指向python库所在目录的标志LDFLAGS="-L/usr/non-standard-path/python/lib"
。 This is most likely "/usr/local/lib"
, if you are using homebrew. 如果您使用自制软件,这很可能是"/usr/local/lib"
。
I was getting this error when I was trying to install graph-tool
using outdated an autoconf
/ automake
/ pkg-config
combination (installed using yum
in CentOS 5.10). 当我尝试使用过时的autoconf
/ automake
/ pkg-config
组合(使用CentOS 5.10中的yum
安装)安装graph-tool
时,我收到此错误。 Installing those packages from source fixed the problem... although I'm not sure how this related to my python installation.... 从源代码安装这些软件包修复了问题...虽然我不确定这与我的python安装有什么关系....
It worked for me by passing the variable PYTHON_EXTRA_LDFLAGS="-Wl,-stack_size,1000000 -F/usr/local/Cellar/python3/3.6.3/Frameworks -framework CoreFoundation"
. 它通过传递变量PYTHON_EXTRA_LDFLAGS="-Wl,-stack_size,1000000 -F/usr/local/Cellar/python3/3.6.3/Frameworks -framework CoreFoundation"
。
In your case, it would be the path to the homebrew
installation of python3.4
. 在您的情况下,它将是homebrew
的python3.4
安装的python3.4
。
The way I found out is that in the config.log
, the error message shows the following: 我发现的方法是在config.log
,错误消息显示以下内容:
configure:19023: checking python extra libraries
configure:19030: result: -ldl -framework CoreFoundation
configure:19037: checking python extra linking flags
configure:19044: result: -Wl,-stack_size,1000000 -framework CoreFoundation Python.framework/Versions/3.6/Python
configure:19051: checking consistency of all components of python development environment
configure:19079: gcc -o conftest -g -O2 -DNDEBUG -I/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/include/python3.6m -F/usr/local/Cellar/python3/3.6.3/Frameworks/ -Wl,-stack_size,1000000 -framework CoreFoundation Python.framework/Versions/3.6/Python conftest.c -L/usr/local/opt/python3/Frameworks/Python.framework/Versions/3.6/lib -lpython3.6m -ldl -framework CoreFoundation -ldl -framework CoreFoundation >&5
clang: error: no such file or directory: 'Python.framework/Versions/3.6/Python'
The error seems to be path 'Python.framework/Versions/3.6/Python'
, that in a homebrew
installation does not exist. 错误似乎是路径'Python.framework/Versions/3.6/Python'
,在homebrew
安装中不存在。 I search for the same path in the config.log
and I found this line: 我在config.log
搜索相同的路径,我找到了这一行:
PYTHON_EXTRA_LDFLAGS="-Wl,-stack_size,1000000 -framework CoreFoundation Python.framework/Versions/3.6/Python"
So, the solution for me was to pass this variable with the right path. 所以,我的解决方案是用正确的路径传递这个变量。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.