使用Python 3.4在OSX上构建图形工具

问题描述 投票:5回答:3

我尝试使用自制软件在Mac OSX 10.10上安装图形工具。 brew构建过程工作正常,但是当我尝试导入图形工具时,我得到了the error described in this question。自制软件的另一个问题是我总是为python2.7构建图形工具,并将软件包安装在Python 2.7 sit-packages文件夹中。但我想在Python 3.4中使用它。这些是我尝试从源代码构建图形工具的原因。

./configure命令也自动使用Python 2.7。所以我用./configure PYTHON=python3.4传递了所需的Python版本

然后它会检测正确的版本以及相关路径,但会因以下错误而崩溃:

配置:错误: 无法将测试程序链接到Python。也许主要的Python库已经安装在一些非标准的库路径中。如果是,请通过LDFLAGS环境变量将其传递给configure。 示例:./ configure LDFLAGS =“ - L / usr / non-standard-path / python / lib”

================================================== ====================错误!您可能必须为您的发行版安装Python包的开发版本。这个包的确切名称因其而异。

======================================================================

使用和不使用PYTHON变量集时会发生错误。从./configure的输出我可以看到一切正常,除了最后一行,它说:

检查python开发环境的所有组件的一致性...没有

上述行是什么意思,我如何在我的机器上正确安装图形工具?

python macos python-3.4 graph-tool
3个回答
2
投票

错误消息正在解释需要完成的工作。由于python安装在非标准路径中,因此需要传递指向python库所在目录的标志LDFLAGS="-L/usr/non-standard-path/python/lib"。如果您使用自制软件,这很可能是"/usr/local/lib"


0
投票

当我尝试使用过时的graph-tool / autoconf / automake组合(在CentOS 5.10中使用pkg-config安装)安装yum时,我得到了这个错误。从源代码安装这些软件包修复了问题...虽然我不确定这与我的python安装有什么关系....


0
投票

它通过传递变量PYTHON_EXTRA_LDFLAGS="-Wl,-stack_size,1000000 -F/usr/local/Cellar/python3/3.6.3/Frameworks -framework CoreFoundation"为我工作。 在你的情况下,它将是homebrew安装python3.4的路径。 我发现的方式是在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'

错误似乎是路径'Python.framework/Versions/3.6/Python',在homebrew安装不存在。我在config.log中搜索相同的路径,我找到了这一行:

PYTHON_EXTRA_LDFLAGS="-Wl,-stack_size,1000000 -framework CoreFoundation Python.framework/Versions/3.6/Python"

所以,我的解决方案是用正确的路径传递这个变量。

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