在Python 3.4.4和Linux中安装Numpy

时间:2016-06-21 00:48:00

标签: python ubuntu numpy

我刚刚安装了Ubuntu 16.04,其中包括Python 2.7.11和3.5.1。

我也成功安装了Python 3.4.4。但是当我尝试使用以下内容安装numpy

sudo apt-get install python-numpy 
sudo apt-get install python3-numpy 

它安装了Python 2.7.11和3.5.1但我需要它用于Python 3.4.4。我该如何安装?

1 个答案:

答案 0 :(得分:3)

来自python docs:当使用并行安装的多个版本的Python时,下面的命令可以与pip一起用于为特定版本的Python安装Python包:

python2   -m pip install SomePackage  # default Python 2
python2.7 -m pip install SomePackage  # specifically Python 2.7
python3   -m pip install SomePackage  # default Python 3
python3.4 -m pip install SomePackage  # specifically Python 3.4
python3.5 -m pip install SomePackage  # specifically Python 3.5

因此,要为Python3.4安装numpy包,您可以使用以下命令:

~/$ python3.4 -m pip install numpy