I installed python-igraph using synaptic on my Ubuntu 14.04 machine. build-essential and python-dev are installed as well. But when I try to access anything within this library, nothing seems to work except importing the package. I'm using python 2.7.6.
First I try this:
import igraph
Output: nothing, so far so good.
With
import igraph
from igraph import *
I still get no output, so there should be nothing wrong.
For
import igraph
from igraph import *
dir(igraph)
I still get nothing, which is weird.
And if I start using igraph,
import igraph
from igraph import *
print igraph.__version__
this comes up:
Traceback (most recent call last):
File "./igraph.py", line 1, in <module>
import igraph
File "/home/everdream/Downloads/igraph.py", line 3, in <module>
print igraph.__version__
AttributeError: 'module' object has no attribute '__version__'
Another example:
import igraph
from igraph import *
g = igraph.Graph.Tree(127, 2)
I get
Traceback (most recent call last):
File "./igraph.py", line 1, in <module>
import igraph
File "/home/everdream/Downloads/igraph.py", line 3, in <module>
g = igraph.Graph.Tree(127, 2)
AttributeError: 'module' object has no attribute 'Graph'
Can anyone advice me on what might be causing my problem? I don't even know where I should look for it.
You called your file /home/everdream/Downloads/igraph.py
, rename it and remove the igraph.pyc
file. You are trying to import from this file not the actual igraph
module.
import igraph;print igraph.__file__
will show you which file you have imported.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.