问题
I just installed python-igraph 0.7.1 from source with no problems. I didn't already have the C library installed because using the repository version caused errors while building, but setup.py successfully compiled it.
However, now I can't import it. I get the following error:
>>> import igraph
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/jeffcollins/Downloads/python-igraph-0.7.1/igraph/__init__.py", line 34, in <module>
from igraph._igraph import *
ImportError: No module named 'igraph._igraph'
Prior to my upgrade from trusty to vivid I didn't have this problem, but my install on trusty was long enough ago that I don't remember if anything else relevant has changed (not the Python or python-igraph versions, though).
My system info, if relevant:
- Samsung Chromebook 2
- ARMv7 Processor rev 3 (v7l) x4
- Ubuntu 15.04 (via crouton)
- Python 3.4.3
回答1:
This usually happens when you are standing right in the folder where you extracted the source tree to. The source tree contains a folder named igraph, but there is no _igraph.so within it - _igraph.so is created in some subfolder of build when you build igraph. When you type import igraph, Python thinks that you meant the igraph folder relative to the current folder, not the igraph package that you have just installed.
Solution: change to another directory that does not have a subfolder named igraph, and try again.
回答2:
I think it might not be python 3.4.3 maybe. Just a thought, since I've tried tons of websites for this on a chromebook. If you could tell me where you downloaded it from, that would help me a lot. :)
来源:https://stackoverflow.com/questions/32342541/no-module-named-igraph-igraph