繁体   English   中英

安装后我无法在python 2.6上导入igraph

[英]I cannot import igraph on python 2.6 after installation

我在OSX 10.7上为python 2.6安装了igraph,但无法导入igraph库。

它显示导入错误:无模块名称igraph。

我不知道。 请帮帮我。

谢谢。

但是,我无法使用python运行代码。 我编写了代码,并尝试运行,例如“ python ex.py”

好的,即使您没有回答我的大多数问题,我也很确定我能猜到您的问题。 您的问题标题是“安装后我无法在python 2.6上导入igraph”,但您没有尝试在python 2.6上导入它,而是在2.7上尝试。

$ python
Python 2.7.2 (default, Jun 20 2012, 16:23:33) 
[GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import igraph
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named igraph
>>>

$ python2.6
Python 2.6.7 (r267:88850, Jun 20 2012, 16:23:38) 
[GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import igraph
>>>

看到不同? OS X 10.7(和10.8)随附三个Python版本:2.5、2.6和2.7。 它们是完全独立的安装,因此,当您为Python 2.6安装igraph时,并没有为2.5或2.7安装安装它。

缺省值是2.7,仅在运行python时获得。 如果需要特定版本,则必须运行python2.6

因此,您需要运行python2.6或为2.7安装igraph。

附带说明一下,如果您已经安装了任何第三方Python安装程序,将会更加困惑,所以请不要这样做(或者如果已经拥有,请先卸载),直到您真正了解自己的内容为止在做。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM