简体   繁体   English

通过Synaptic安装python3-numpy,但无法在python3中导入模块numpy

[英]install python3-numpy via Synaptic but cannot import module numpy in python3

The same think happens for python3-scipy. python3-scipy也有同样的想法。 I installed python-numpy/scipy, python3-numpy/scipy/ using Synaptic. 我使用Synaptic安装了python-numpy / scipy,python3-numpy / scipy /。 But they are installed under python3 not python3.2 . 但是它们安装在python3下而不是python3.2 My system is Ubuntu 12. Can anyone have experience of Synaptic? 我的系统是Ubuntu12。任何人都可以体验Synaptic吗?

ImportError: No module named numpy.

On Ubuntu 12.04 /usr/bin/python3.2 and /usr/bin/python3 is the same Python. 在Ubuntu 12.04上,/usr/bin/python3.2和/ usr / bin / python3是相同的Python。 Hence, if it is installed for /usr/bin/python3 it is also installed for /usr/bin/python3.2 (unless you have overwritten /usr/bin/python3.2, of course). 因此,如果为/ usr / bin / python3安装了它,那么也为/usr/bin/python3.2安装了它(当然,除非您覆盖了/usr/bin/python3.2)。

I therefore suspect that you have more than one installation of Python on your machine, perhaps a /usr/local/bin/python3.2? 因此,我怀疑您的计算机上安装了多个Python,也许是/usr/local/bin/python3.2?

When you install a module with Synaptic (or apt-get or aptitude etc) it will be installed only for the system-provided Python, ie the ones in /usr/bin. 当您使用Synaptic(或apt-get或aptitude等)安装模块时,将仅为系统提供的Python(即/ usr / bin中的Python)安装该模块。 If you want to use it for any other installation, you have to install it for that installation as well, and then you need to follow the installation instructions from that packages documentation. 如果要将其用于其他任何安装,则也必须为该安装安装它,然后需要按照该软件包文档中的安装说明进行操作。

Often pip install <packagename> will work, but not all packages are installable that way (most notably pip itself, of course). pip install <packagename>通常可以工作,但并非所有软件包都可以这种方式安装(当然,最明显的是pip本身)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM