2013-07-02 42 views
1

我有Ubuntu 12.10。 我試圖安裝python的幾個包,如numpy,scipy和matplotlib。 我跑commandpython上的numpy 3

sudo apt-get install python-numpy python-scipy python-matplotlib 

但是,當我嘗試導入Python的(3.2)外殼matplotlib(甚至numpy的和SciPy的),我得到這樣

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

錯誤然而,我試着在Linux外殼上啓動python並導入模塊:這裏沒有問題...

爲什麼我可以在Python 2.x上導入模塊而不是在3.x上?

回答

2

您安裝了python 2.x的軟件包。這樣做:

sudo apt-cache search numpy | grep 3

你會得到多家上市包。從這些,在我的Ubuntu,我會選擇:

sudo apt-get install python3-numpy

+0

這個工作了numpy的和SciPy的相當不錯。但是,我仍然不能使用matplotlib。我嘗試通過pip(https://pypi.python.org/pypi/pip)進行安裝並升級我的系統,但是我無法在python 3上導入它... – bigTree

+1

沒有自己安裝它的經驗,但在12.10上看起來不是很微不足道:(http://joat-programmer.blogspot.com/2012/11/install-matplotlib-on-ubuntu-1210-for.html) – ondrejdee

+0

沒有看到它。謝謝! – bigTree