天天看點

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