Python 在没有pip/anaconda的Ubuntu上安装numpy

Python 在没有pip/anaconda的Ubuntu上安装numpy,python,numpy,ubuntu,Python,Numpy,Ubuntu,在Ubuntu上安装numpy并打印numpy版本时,不使用anaconda或pip,我得到以下信息: Traceback (most recent call last): File "/usr/lib/python3/dist-packages/numpy/core/__init__.py", line 17, in <module> from . import multiarray File "/usr/lib/python3/dist-packages/nump

在Ubuntu上安装
numpy
并打印numpy版本时,不使用
anaconda或pip
,我得到以下信息:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/numpy/core/__init__.py", line 17, in <module>
    from . import multiarray
  File "/usr/lib/python3/dist-packages/numpy/core/multiarray.py", line 14, in <module>
    from . import overrides
  File "/usr/lib/python3/dist-packages/numpy/core/overrides.py", line 7, in <module>
    from numpy.core._multiarray_umath import (
ModuleNotFoundError: No module named 'numpy.core._multiarray_umath'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "basicVersions.py", line 2, in <module>
    import numpy as np
  File "/usr/lib/python3/dist-packages/numpy/__init__.py", line 142, in <module>
    from . import core
  File "/usr/lib/python3/dist-packages/numpy/core/__init__.py", line 47, in <module>
    raise ImportError(msg)
ImportError: 

IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!

Importing the numpy c-extensions failed.
- Try uninstalling and reinstalling numpy.
- If you have already done that, then:
  1. Check that you expected to use Python3.7 from "/usr/bin/python3.7",
     and that you have no directories in your PATH or PYTHONPATH that can
     interfere with the Python and numpy version "1.17.4" you're trying to use.
  2. If (1) looks fine, you can open a new issue at
     https://github.com/numpy/numpy/issues.  Please include details on:
     - how you installed Python
     - how you installed numpy
     - your operating system
     - whether or not you have multiple versions of Python installed
     - if you built from source, your compiler versions and ideally a build log

- If you're working with a numpy git repository, try `git clean -xdf`
  (removes all files not under version control) and rebuild numpy.

Note: this error has many possible causes, so please don't comment on
an existing issue about this - open a new one instead.

Original error was: No module named 'numpy.core._multiarray_umath'
这可能是python版本的问题吗? 这就是我尝试的代码:

import sys
import numpy as np
import matplotlib

print("Python: ", sys.version)
print("Numpy: ", np.__version__)
print("Matplotlib: ", matplotlib.__version__)

解决方案是使用
python3
作为命令,而不是
python3.7

在一个终端中,python3-c“import numpy as np;print(np.\uu version\uuuuuu)”的输出是什么??python3-c“import numpy as np;print(np.\uu version\uuuuuuu)”1.17.4On
ubuntu
我使用一个包管理器(
synaptic
)来安装Python的完整开发版本(这将安装所有基本的
.h
文件),
python3所有开发版
。我不记得我是否单独安装了
setuptools
。从那里我还可以安装
numpy
,但更喜欢使用
pip3
,这样我就可以获得最新版本的软件包了。
ubuntu
存储库滞后(例如1.13与最新的1.18相比)。换句话说,我使用
ubuntu
获取最新版本的基础、背景资料和
pip
。你的意思是从synaptic manager可以安装
numpy
?并且它不会导致任何版本控制问题?你是否运行了用
python3
触发错误的程序(不是python)?
import sys
import numpy as np
import matplotlib

print("Python: ", sys.version)
print("Numpy: ", np.__version__)
print("Matplotlib: ", matplotlib.__version__)