已安装NetworkX但无法将其导入Python IDLE

时间:2014-01-20 22:30:35

标签: python networkx

需要帮助确认我的NetworkX安装并成功将NetworkX导入Python IDLE。

我有Mac OS X 10.7.5并且安装了Python 3.3应用程序。我以前成功使用过Python 3.3。

我通过执行以下步骤安装了Network X:

 1. downloaded networkx-1.8.1.tar.gz  into my Downloads folder
 2. double clicked on the the  tar.gz file, and the contents were extracted 
    in a subfolder called networkx-1.8.1
 3. went into Mac Terminal and changed my directory to the Downloads/networkx-1.8.1 folder
 4. I entered the following Terminal command to install Networkx:  
    sudo python ./setup.py install  
    This installation appears to be successful.
 5. I opened IDLE and typed:  import networkx as nx, and I received the following error
    message:

   ERROR MESSAGE:

   >>> import networkx as nx
   Traceback (most recent call last):
     File "<pyshell#1>", line 1, in <module>
       import networkx as nx
   ImportError: No module named 'networkx'
   >>> 

我的问题是:      1.你知道NetworkX是否与Python 3.3兼容?      2.你知道我如何将NetworkX导入IDLE以便我可以使用它吗?

非常感谢您提供的任何帮助。 : - )

1 个答案:

答案 0 :(得分:0)

我们在Fedora 20系统上遇到了同样的问题。 networkx模块已由最终用户安装,其权限非常严格(目录为700,文件为600)。

即使是那个用户自己也会失败,但是如果加载模块的程序是通过sudo执行的,那就可以了。

最后,将权限更改为/usr/lib64/python2.7/site-packages/networkx-1.9至755/644下的所有文件,使模块可见,程序正常运行。

(您的图书馆位置当然可能不同)。我们运行Python 2.7.5。