[英]Problems Installing Python igraph
I installed the igraph python library using pip我使用 pip 安装了 igraph python 库
sudo pip install python-igraph
I go on the Python console/terminal and import the module我进入 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
No problem.没问题。 Then I test to see the version number
然后我测试看看版本号
>>> print igraph.__version__
0.6
No problem there either.那里也没有问题。 But when I try to create a script.
但是当我尝试创建脚本时。
from igraph import *
g = Graph()
And execute并执行
python2.7 script.py
or或者
python script.py
All i get is我得到的只是
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
Try this, as your script:试试这个,作为你的脚本:
import igraph
g = igraph.Graph(1)
Global imports are generally not encouraged.一般不鼓励全球进口。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.