我以前有 numpy 工作过。不知道发生了什么,但现在我收到导入错误:
>>> import numpy
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named numpy
我已尝试按照其他答案中的建议使用 pip 和 apt (导入错误:名为 numpy 的模块)卸载和重新安装 numpy,但这并没有解决我的问题。它说我有最新版本的 numpy:
$ sudo apt install python-numpy
Reading package lists... Done
Building dependency tree
Reading state information... Done
python-numpy is already the newest version (1:1.13.3-2ubuntu1).
The following packages were automatically installed and are no longer required:
libllvm6.0 libllvm6.0:i386 libllvm7 libllvm7:i386
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 79 not upgraded.
$ python -c "import numpy"
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: No module named numpy
顺便提一下,numpy 在 python3 中运行良好。