我已经在 Windows 版 Pycharm 上安装了 igraph。
import igraph
没有错误。
import igraph
print igraph.__version__
产量:0.1.5。
import igraph
dir(igraph)
什么都没有……
import igraph
g = igraph.Graph(1)
产量:
Traceback (most recent call last):
File "C:/Users/Margaret/PycharmProjects/untitled/trial.py", line 2, in g = igraph.Graph(1)
AttributeError: 'module' object has no attribute 'Graph'
有人知道问题出在哪里吗?我查看了我能找到的所有先前提出的问题,但没有找到适合我的案例的答案。谢谢。
最佳答案
PyPI 上有两个igraph
库,igraph
和 python-igraph
.
您安装了 igraph
,但这是错误的。卸载它使用:
pip uninstall igraph
因为您在 Windows 上,您可能需要一个预编译的发行版,称为 wheel。
This site有很多可以使用 pip
安装的轮子。这是 the wheel for python-igraph
.
安装使用,例如:
pip install python_igraph-0.7.1.post4-cp27-none-win32.whl
关于python - python-igraph 错误 'module' 对象没有属性 'Graph',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29159881/