问题
I installed NumPy by running the following in a linux shell:
sudo apt-get install python-numpy
In Idle for python 3.30 when I import numpy it outputs the following:
Python 3.3.0 (default, Sep 29 2012, 17:14:58)
[GCC 4.7.2] on linux
Type "copyright", "credits" or "license()" for more information.
>>> import numpy
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import numpy
File "/usr/lib/python3/dist-packages/numpy/__init__.py", line 137, in <module>
from . import add_newdocs
File "/usr/lib/python3/dist-packages/numpy/add_newdocs.py", line 9, in <module>
from numpy.lib import add_newdoc
File "/usr/lib/python3/dist-packages/numpy/lib/__init__.py", line 4, in <module>
from .type_check import *
File "/usr/lib/python3/dist-packages/numpy/lib/type_check.py", line 8, in <module>
import numpy.core.numeric as _nx
File "/usr/lib/python3/dist-packages/numpy/core/__init__.py", line 5, in <module>
from . import multiarray
ImportError: cannot import name multiarray
>>>
I also have SciPy, matplotlib, and mayavi2 installed. They also through errors when I import them.
Why does this happen. How can I fix this?
回答1:
On my ubuntu 12.10. I use pip to install packages. I use Python3.2.
sudo apt-get install python3-pip
sudo pip-3.2 install numpy
I have tried this and installed numpy successfully.
来源:https://stackoverflow.com/questions/16096143/why-doesnt-numpy-import-in-idle-3-30-on-ubuntu-12-10-64-bit