天天看点

The error in python :ImportError: No module named xxx

        只要出现ImportError 错误就说明有一个包缺失。在本例中,我们安装的networkx 模块有一个未作处理的依赖项——numpy ,它是一个高度优化的科学计算工具集。通常,再次调用easy_install 就可以解决这个问题,处理numpy 缺失的方法与安装NetworkX 的方法一样。只要关闭解释器,并且在终端输入easy_install numpy 即可安装该依赖项.

    like mine:

点击(此处)折叠或打开

  1. >>> import networkx as nx
  2. Traceback (most recent call last):
  3.   File "<stdin>", line 1, in <module>
  4. ImportError: No module named networkx
  5. >>> exit()
  6. [email protected]:~$ sudo easy_install networkx
  7. Searching for networkx
  8. .......
  9. Installed /usr/local/lib/python2.7/dist-packages/decorator-4.0.2-py2.7.egg
  10. Finished processing dependencies for networkx

the more detail:

http://my.oschina.net/leejun2005/blog/109679

http://book.2cto.com/201301/13763.html