我使用pip
安装了igraph python库sudo pip install python-igraph
我继续使用Python控制台/终端并导入模块
$ python
Python 2.7.4 (default, Sep 26 2013, 03:20:26)
[GCC 4.7.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import igraph
没问题。然后我测试看版本号
>>> print igraph.__version__
0.6
也没问题。但是当我尝试创建一个脚本时。
from igraph import *
g = Graph()
执行
python2.7 script.py
或
python script.py
我得到的只是
Traceback (most recent call last):
File "script.py", line 1, in <module>
from igraph import *
File ".../script.py", line 2, in <module>
g = Graph()
NameError: name 'Graph' is not defined