python - python-igraph 错误 'module' 对象没有属性 'Graph'

标签 python import pycharm igraph

我已经在 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 库,igraphpython-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/

相关文章:

python - 哪种 Python 2.x DHT 实现最容易移植到 Python 3.x?

python - codechef 问题 REDONE 中的运行时 NZEC 错误

python - Tkinter:框架(?)四处移动

python - 在 Pycharm 中的 for 循环内调试列表理解

python - Google App Engine 中 imp.load_module() 的替换功能?

wordpress - 从外部 URL 导入 WordPress 帖子图像作为特色图像

objective-c - 如何将 Swift 代码导入 Objective-C?

python - pycharm自动将制表符转换为空格

python - 如何使用 PyCharm 运行文档测试?

python - 运行一个从 PowerShell 显式获取参数的 Python 函数(不单独传递参数)