我能够(经过一番挣扎)pip install networkit
在python3.6 anaconda环境中安装networkit(我在Mac OSX high sierra上)。为了使 networkit 工作,我必须安装一个支持 OpenMp 的 g++ 编译器,所以我选择了brew install gcc
. 安装很顺利,但是导入模块时出现错误
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-2-0547b3a80fd8> in <module>()
----> 1 import networkit
//anaconda/envs/py36/lib/python3.6/site-packages/networkit/__init__.py in <module>()
41 # local imports
42 from . import stopwatch
---> 43 from . import graph
44 from . import graphio
45 from . import community
//anaconda/envs/py36/lib/python3.6/site-packages/networkit/graph.py in <module>()
1 # extension imports
----> 2 from _NetworKit import Graph, SpanningForest, GraphTools, RandomMaximumSpanningForest, UnionMaximumSpanningForest
ImportError: dlopen(//anaconda/envs/py36/lib/python3.6/site-packages/_NetworKit.cpython-36m-darwin.so, 2): Symbol not found: _GOMP_parallel
Referenced from: //anaconda/envs/py36/lib/python3.6/site-packages/_NetworKit.cpython-36m-darwin.so
Expected in: flat namespace
in //anaconda/envs/py36/lib/python3.6/site-packages/_NetworKit.cpython-36m-darwin.so
我认为这取决于我没有使用 Homebrew gcc 而是使用不支持 OpenMP 的默认 Apple Clang 的事实。我的问题是:如何设置g++-7
为默认编译器,以便让我的 networkit 模块启动并运行?