问题描述
对于 python 3.2,我使用了 sudo apt-get install python3.2-numpy
.它起作用了.python3.3怎么办?没有什么我能想到的作品.scipy 等也是如此.谢谢.
这是它的样子
radu@sunlit-inspired:~$ python3Python 3.3.2(默认,2013 年 7 月 3 日,10:17:40)[GCC 4.6.3] 在 Linux 上输入帮助"、版权"、信用"或许可证"以获取更多信息.>>>导入 numpy回溯(最近一次调用最后一次):文件<stdin>",第 1 行,在 <module> 中导入错误:没有名为numpy"的模块
在下面的解决方案中,我使用 python3.4
作为二进制文件,但它可以安全地用于任何版本的 Python 或二进制文件.它在 Windows 上也能正常工作(显然使用 wget
下载 pip 除外,但只需将文件保存在本地并使用 python 运行).
如果你安装了多个版本的 python,这很好,这样你就可以管理每个 python 版本的外部库.
所以首先,我推荐 get-pip.py
,安装 pip 很棒:
wget https://bootstrap.pypa.io/get-pip.py
然后你需要为你的python版本安装pip,我有python3.4
所以对我来说这是命令:
python3.4 get-pip.py
现在为 python3.4
安装了 pip,为了获得 python3.4
的库,需要在这个版本中调用它,就像这样:
python3.4 -m pip
所以如果你想安装 numpy 你会使用:
python3.4 -m pip install numpy
请注意,numpy
是一个很重的库.我以为我的系统挂了并且失败了.但是使用verbose选项,你可以看到系统很好:
python3.4 -m pip install numpy -v
这可能会告诉您缺少 python.h,但您可以轻松获取它:
在 RHEL(Red hat、CentOS、Fedora)上,它会是这样的:
yum install python34-devel
在类 debian(Debian、Ubuntu、Kali 等)上:
apt-get install python34-dev
然后重新运行:
python3.4 -m pip install numpy -v
For python 3.2 I used sudo apt-get install python3.2-numpy
.It worked.What to do for python3.3? Nothing I could think of works. Same goes for scipy, etc.Thanks.
Edit: this is how it looks like
radu@sunlit-inspired:~$ python3
Python 3.3.2 (default, Jul 3 2013, 10:17:40)
[GCC 4.6.3] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named 'numpy'
In the solution below I used python3.4
as binary, but it's safe to use with any version or binary of python. it works fine on windows too (except the downloading pip with wget
obviously but just save the file locally and run it with python).
This is great if you have multiple versions of python installed, so you can manage external libraries per python version.
So first, I'd recommend get-pip.py
, it's great to install pip :
wget https://bootstrap.pypa.io/get-pip.py
Then you need to install pip for your version of python, I have python3.4
so for me this is the command :
python3.4 get-pip.py
Now pip is installed for python3.4
and in order to get libraries for python3.4
one need to call it within this version, like this :
python3.4 -m pip
So if you want to install numpy you would use :
python3.4 -m pip install numpy
Note that numpy
is quite the heavy library. I thought my system was hanging and failing.But using the verbose option, you can see that the system is fine :
python3.4 -m pip install numpy -v
这篇关于在python3.3上安装numpy - 为python3安装pip的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!