隻要出現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