python3 的pip安装module错误

 pip install numpy

安装报错

ERROR: Exception:
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/pip-19.3.1-py3.6.egg/pip/_internal/cli/base_command.py", line 153, in _main
    status = self.run(options, args)
  File "/usr/local/lib/python3.6/site-packages/pip-19.3.1-py3.6.egg/pip/_internal/commands/install.py", line 328, in run
    session = self.get_default_session(options)
  File "/usr/local/lib/python3.6/site-packages/pip-19.3.1-py3.6.egg/pip/_internal/cli/req_command.py", line 72, in get_default_session
    self._session = self.enter_context(self._build_session(options))
  File "/usr/local/lib/python3.6/site-packages/pip-19.3.1-py3.6.egg/pip/_internal/cli/req_command.py", line 84, in _build_session
    index_urls=self._get_index_urls(options),
  File "/usr/local/lib/python3.6/site-packages/pip-19.3.1-py3.6.egg/pip/_internal/network/session.py", line 240, in __init__
    self.headers["User-Agent"] = user_agent()
  File "/usr/local/lib/python3.6/site-packages/pip-19.3.1-py3.6.egg/pip/_internal/network/session.py", line 133, in user_agent
    zip(["name", "version", "id"], distro.linux_distribution()),
  File "/usr/local/lib/python3.6/site-packages/pip-19.3.1-py3.6.egg/pip/_vendor/distro.py", line 122, in linux_distribution
    return _distro.linux_distribution(full_distribution_name)
  File "/usr/local/lib/python3.6/site-packages/pip-19.3.1-py3.6.egg/pip/_vendor/distro.py", line 677, in linux_distribution
    self.version(),
  File "/usr/local/lib/python3.6/site-packages/pip-19.3.1-py3.6.egg/pip/_vendor/distro.py", line 737, in version
    self.lsb_release_attr('release'),
  File "/usr/local/lib/python3.6/site-packages/pip-19.3.1-py3.6.egg/pip/_vendor/distro.py", line 899, in lsb_release_attr
    return self._lsb_release_info.get(attribute, '')
  File "/usr/local/lib/python3.6/site-packages/pip-19.3.1-py3.6.egg/pip/_vendor/distro.py", line 552, in __get__
    ret = obj.__dict__[self._fname] = self._f(obj)
  File "/usr/local/lib/python3.6/site-packages/pip-19.3.1-py3.6.egg/pip/_vendor/distro.py", line 1012, in _lsb_release_info
    stdout = subprocess.check_output(cmd, stderr=devnull)
  File "/usr/local/lib/python3.6/subprocess.py", line 336, in check_output
    **kwargs).stdout
  File "/usr/local/lib/python3.6/subprocess.py", line 418, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '('lsb_release', '-a')' returned non-zero exit status 1.
Traceback (most recent call last):
  File "/usr/local/bin/pip", line 11, in 
    load_entry_point('pip==19.3.1', 'console_scripts', 'pip')()
  File "/usr/local/lib/python3.6/site-packages/pip-19.3.1-py3.6.egg/pip/_internal/main.py", line 47, in main
    return command.main(cmd_args)
  File "/usr/local/lib/python3.6/site-packages/pip-19.3.1-py3.6.egg/pip/_internal/cli/base_command.py", line 103, in main
    return self._main(args)
  File "/usr/local/lib/python3.6/site-packages/pip-19.3.1-py3.6.egg/pip/_internal/cli/base_command.py", line 191, in _main
    self.handle_pip_version_check(options)
  File "/usr/local/lib/python3.6/site-packages/pip-19.3.1-py3.6.egg/pip/_internal/cli/req_command.py", line 139, in handle_pip_version_check
    timeout=min(5, options.timeout)
  File "/usr/local/lib/python3.6/site-packages/pip-19.3.1-py3.6.egg/pip/_internal/cli/req_command.py", line 84, in _build_session
    index_urls=self._get_index_urls(options),
  File "/usr/local/lib/python3.6/site-packages/pip-19.3.1-py3.6.egg/pip/_internal/network/session.py", line 240, in __init__
    self.headers["User-Agent"] = user_agent()
  File "/usr/local/lib/python3.6/site-packages/pip-19.3.1-py3.6.egg/pip/_internal/network/session.py", line 133, in user_agent
    zip(["name", "version", "id"], distro.linux_distribution()),
  File "/usr/local/lib/python3.6/site-packages/pip-19.3.1-py3.6.egg/pip/_vendor/distro.py", line 122, in linux_distribution
    return _distro.linux_distribution(full_distribution_name)
  File "/usr/local/lib/python3.6/site-packages/pip-19.3.1-py3.6.egg/pip/_vendor/distro.py", line 677, in linux_distribution
    self.version(),
  File "/usr/local/lib/python3.6/site-packages/pip-19.3.1-py3.6.egg/pip/_vendor/distro.py", line 737, in version
    self.lsb_release_attr('release'),
  File "/usr/local/lib/python3.6/site-packages/pip-19.3.1-py3.6.egg/pip/_vendor/distro.py", line 899, in lsb_release_attr
    return self._lsb_release_info.get(attribute, '')
  File "/usr/local/lib/python3.6/site-packages/pip-19.3.1-py3.6.egg/pip/_vendor/distro.py", line 552, in __get__
    ret = obj.__dict__[self._fname] = self._f(obj)
  File "/usr/local/lib/python3.6/site-packages/pip-19.3.1-py3.6.egg/pip/_vendor/distro.py", line 1012, in _lsb_release_info
    stdout = subprocess.check_output(cmd, stderr=devnull)
  File "/usr/local/lib/python3.6/subprocess.py", line 336, in check_output
    **kwargs).stdout
  File "/usr/local/lib/python3.6/subprocess.py", line 418, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '('lsb_release', '-a')' returned non-zero exit status 1.

python3 的pip安装module错误_第1张图片

解决方法

sudo vim /usr/bin/lsb_release

python3 的pip安装module错误_第2张图片

将python3改成python3.6

保存

再执行

 pip install numpy

你可能感兴趣的:(python)