1.报错背景

ubuntu中python3安装numpy,报错如下:

self.cmdclass[command] = cmdclass = ep.load()

File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/__init__.py", line 2324, in load

return self.resolve()

File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/__init__.py", line 2330, in resolve

module = __import__(self.module_name, fromlist=['__name__'], level=0)

ModuleNotFoundError: No module named 'setuptools.command.build'

2.解决方案

不能直接pip3安装上述模块,只需升级一下,即可安装numpy了,如下:

python3 -m pip install --upgrade pip setuptools wheel