只要出现ImportError 错误就说明有一个包缺失。在本例中,我们安装的networkx 模块有一个未作处理的依赖项——numpy ,它是一个高度优化的科学计算工具集。通常,再次调用easy_install 就可以解决这个问题,处理numpy 缺失的方法与安装NetworkX 的方法一样。只要关闭解释器,并且在终端输入easy_install numpy 即可安装该依赖项.
like mine:
点击(此处)折叠或打开
- >>> import networkx as nx
- Traceback (most recent call last):
- File "<stdin>", line 1, in <module>
- ImportError: No module named networkx
- >>> exit()
- [email protected]:~$ sudo easy_install networkx
- Searching for networkx
- .......
- Installed /usr/local/lib/python2.7/dist-packages/decorator-4.0.2-py2.7.egg
- Finished processing dependencies for networkx
the more detail:
http://my.oschina.net/leejun2005/blog/109679
http://book.2cto.com/201301/13763.html