[英]python cannot import graph-tool after installing it on a mac using brew (homebrew)
[英]Installing graph-tool on OSX 10.10 with homebrew
我嘗試使用以下命令安裝graphtool:
brew tap homebrew/science
brew install graph-tool
安裝成功完成但是當我導入graph_tool時,我看到以下“找不到符號”錯誤:
Python 2.7.10 (default, Jul 14 2015, 19:46:27)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import graph_tool
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/site-packages/graph_tool/__init__.py", line 105, in <module>
dl_import("from . import libgraph_tool_core as libcore")
File "/usr/local/lib/python2.7/site-packages/graph_tool/dl_import.py", line 57, in dl_import
exec(import_expr, local_dict, global_dict)
File "<string>", line 1, in <module>
ImportError: dlopen(/usr/local/lib/python2.7/site-packages/graph_tool/libgraph_tool_core.so, 8): Symbol not found: __ZNK5boost9re_detail31cpp_regex_traits_implementationIcE17transform_primaryEPKcS4_
Referenced from: /usr/local/lib/python2.7/site-packages/graph_tool/libgraph_tool_core.so
Expected in: /usr/local/opt/boost/lib/libboost_regex.dylib
in /usr/local/lib/python2.7/site-packages/graph_tool/libgraph_tool_core.so
>>> exit()
在閱讀了一下之后,我認為可能存在使用不同編譯器來編譯boost與graph-tool的問題。 我卸載了boost,boost-python和graph-tool並重新安裝,從源代碼編譯。
brew -v install --with-icu4c --build-from-source --with-c++11 boost
brew -v install --with-icu4c --build-from-source --with-c++11 boost-python
brew -v install --build-from-source graph-tool --without-scipy --without-matplotlib --without-numpy
boost和boost-python是成功的,但是圖形工具失敗了:
Making install in centrality
CXX graph_centrality_bind.lo
CXX graph_betweenness.lo
CXX graph_closeness.lo
CXX graph_eigentrust.lo
CXX graph_eigenvector.lo
CXX graph_hits.lo
../../../../src/graph/centrality/graph_hits.cc:71:44: error: 'placeholders' is not a class, namespace, or enumeration
(g, std::bind(get_hits_dispatch(), placeholders::_1, g.get_vertex_index(),
^
../../../../src/graph/centrality/graph_hits.cc:71:44: error: reference to 'placeholders' is ambiguous
(g, std::bind(get_hits_dispatch(), placeholders::_1, g.get_vertex_index(),
^
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/functional:1863:11: note: candidate found by name lookup is 'std::__1::placeholders'
namespace placeholders
^
/usr/local/include/boost/bind/placeholders.hpp:29:11: note: candidate found by name lookup is 'boost::placeholders'
namespace placeholders
^
../../../../src/graph/centrality/graph_hits.cc:72:23: error: 'placeholders' is not a class, namespace, or enumeration
placeholders::_2, placeholders::_3, y, epsilon, max_iter,
^
../../../../src/graph/centrality/graph_hits.cc:72:23: error: reference to 'placeholders' is ambiguous
placeholders::_2, placeholders::_3, y, epsilon, max_iter,
^
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/functional:1863:11: note: candidate found by name lookup is 'std::__1::placeholders'
namespace placeholders
^
/usr/local/include/boost/bind/placeholders.hpp:29:11: note: candidate found by name lookup is 'boost::placeholders'
namespace placeholders
^
../../../../src/graph/centrality/graph_hits.cc:72:42: error: 'placeholders' is not a class, namespace, or enumeration
placeholders::_2, placeholders::_3, y, epsilon, max_iter,
^
../../../../src/graph/centrality/graph_hits.cc:72:42: error: reference to 'placeholders' is ambiguous
placeholders::_2, placeholders::_3, y, epsilon, max_iter,
^
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/functional:1863:11: note: candidate found by name lookup is 'std::__1::placeholders'
namespace placeholders
^
/usr/local/include/boost/bind/placeholders.hpp:29:11: note: candidate found by name lookup is 'boost::placeholders'
namespace placeholders
^
6 errors generated.
其他配置信息:
==> Formula
Tap: homebrew/science
Path: /usr/local/Library/Taps/homebrew/homebrew-science/graph-tool.rb
==> Configuration
HOMEBREW_VERSION: 0.9.5
ORIGIN: https://github.com/Homebrew/homebrew
HEAD: 4ddb79413782c82840154f75280ff67a1ded10f4
Last commit: 13 hours ago
HOMEBREW_PREFIX: /usr/local
HOMEBREW_REPOSITORY: /usr/local
HOMEBREW_CELLAR: /usr/local/Cellar
HOMEBREW_BOTTLE_DOMAIN: https://homebrew.bintray.com
CPU: quad-core 64-bit broadwell
OS X: 10.10.5-x86_64
Xcode: N/A
CLT: 7.2.0.0.1.1447826929
Clang: 7.0 build 700
X11: N/A
System Ruby: 2.0.0-p481
Perl: /usr/bin/perl
Python: /usr/bin/python
Ruby: /usr/bin/ruby => /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
Java: N/A
也
$ xcode-select -p
/Library/Developer/CommandLineTools
$ gcc --version
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 7.0.2 (clang-700.1.81)
Target: x86_64-apple-darwin14.5.0
Thread model: posix
關於如何從這里開始使用graphtool工作的任何想法?
幾天前我為此開了一個問題: https : //github.com/Homebrew/homebrew-science/issues/3237
不幸的是,第一次嘗試解決方案並不適合我。 也許你會有更好的運氣?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.