python3.5切换为python3.9后,执行pip3 install numpy报错

互联网 2021/9/15 11:04:51

一.问题描述:将Python3.5更新为python3.9后,原来安装的PIP3和python3.9都已经切换过来了,也是存在的,软链接也设置好了,但是在pip3安装时包时,会出现报警,如下: joes@joes:~$ pip3 install numpy Defaulting to user installation because normal site-packages is not wr…

一.问题描述:

       将Python3.5更新为python3.9后,原来安装的PIP3和python3.9都已经切换过来了,也是存在的,软链接也设置好了,但是在pip3安装时包时,会出现报警,如下:

joes@joes:~$ pip3 install numpy
Defaulting to user installation because normal site-packages is not writeable
ERROR: Exception:
Traceback (most recent call last):
  File "/usr/local/python3/lib/python3.9/site-packages/pip/_internal/cli/base_command.py", line 188, in _main
    status = self.run(options, args)
  File "/usr/local/python3/lib/python3.9/site-packages/pip/_internal/cli/req_command.py", line 185, in wrapper
    return func(self, options, args)
  File "/usr/local/python3/lib/python3.9/site-packages/pip/_internal/commands/install.py", line 278, in run
    session = self.get_default_session(options)
  File "/usr/local/python3/lib/python3.9/site-packages/pip/_internal/cli/req_command.py", line 83, in get_default_session
    self._session = self.enter_context(self._build_session(options))
  File "/usr/local/python3/lib/python3.9/site-packages/pip/_internal/cli/req_command.py", line 93, in _build_session
    session = PipSession(
  File "/usr/local/python3/lib/python3.9/site-packages/pip/_internal/network/session.py", line 249, in __init__
    self.headers["User-Agent"] = user_agent()
  File "/usr/local/python3/lib/python3.9/site-packages/pip/_internal/network/session.py", line 132, in user_agent
    zip(["name", "version", "id"], distro.linux_distribution()),
  File "/usr/local/python3/lib/python3.9/site-packages/pip/_vendor/distro.py", line 125, in linux_distribution
    return _distro.linux_distribution(full_distribution_name)
  File "/usr/local/python3/lib/python3.9/site-packages/pip/_vendor/distro.py", line 681, in linux_distribution
    self.version(),
  File "/usr/local/python3/lib/python3.9/site-packages/pip/_vendor/distro.py", line 741, in version
    self.lsb_release_attr('release'),
  File "/usr/local/python3/lib/python3.9/site-packages/pip/_vendor/distro.py", line 903, in lsb_release_attr
    return self._lsb_release_info.get(attribute, '')
  File "/usr/local/python3/lib/python3.9/site-packages/pip/_vendor/distro.py", line 556, in __get__
    ret = obj.__dict__[self._fname] = self._f(obj)
  File "/usr/local/python3/lib/python3.9/site-packages/pip/_vendor/distro.py", line 1014, in _lsb_release_info
    stdout = subprocess.check_output(cmd, stderr=devnull)
  File "/usr/local/python3/lib/python3.9/subprocess.py", line 420, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/usr/local/python3/lib/python3.9/subprocess.py", line 524, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '('lsb_release', '-a')' returned non-zero exit status 1.
Traceback (most recent call last):
  File "/usr/local/bin/pip3", line 8, in <module>
    sys.exit(main())
  File "/usr/local/python3/lib/python3.9/site-packages/pip/_internal/cli/main.py", line 75, in main
    return command.main(cmd_args)
  File "/usr/local/python3/lib/python3.9/site-packages/pip/_internal/cli/base_command.py", line 114, in main
    return self._main(args)
  File "/usr/local/python3/lib/python3.9/site-packages/pip/_internal/cli/base_command.py", line 226, in _main
    self.handle_pip_version_check(options)
  File "/usr/local/python3/lib/python3.9/site-packages/pip/_internal/cli/req_command.py", line 152, in handle_pip_version_check
    session = self._build_session(
  File "/usr/local/python3/lib/python3.9/site-packages/pip/_internal/cli/req_command.py", line 93, in _build_session
    session = PipSession(
  File "/usr/local/python3/lib/python3.9/site-packages/pip/_internal/network/session.py", line 249, in __init__
    self.headers["User-Agent"] = user_agent()
  File "/usr/local/python3/lib/python3.9/site-packages/pip/_internal/network/session.py", line 132, in user_agent
    zip(["name", "version", "id"], distro.linux_distribution()),
  File "/usr/local/python3/lib/python3.9/site-packages/pip/_vendor/distro.py", line 125, in linux_distribution
    return _distro.linux_distribution(full_distribution_name)
  File "/usr/local/python3/lib/python3.9/site-packages/pip/_vendor/distro.py", line 681, in linux_distribution
    self.version(),
  File "/usr/local/python3/lib/python3.9/site-packages/pip/_vendor/distro.py", line 741, in version
    self.lsb_release_attr('release'),
  File "/usr/local/python3/lib/python3.9/site-packages/pip/_vendor/distro.py", line 903, in lsb_release_attr
    return self._lsb_release_info.get(attribute, '')
  File "/usr/local/python3/lib/python3.9/site-packages/pip/_vendor/distro.py", line 556, in __get__
    ret = obj.__dict__[self._fname] = self._f(obj)
  File "/usr/local/python3/lib/python3.9/site-packages/pip/_vendor/distro.py", line 1014, in _lsb_release_info
    stdout = subprocess.check_output(cmd, stderr=devnull)
  File "/usr/local/python3/lib/python3.9/subprocess.py", line 420, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/usr/local/python3/lib/python3.9/subprocess.py", line 524, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '('lsb_release', '-a')' returned non-zero exit status 1.

二.解决方法:

执行:sudo rm /usr/bin/lsb_release,问题解决.

随时随地学软件编程-关注百度小程序和微信小程序
关于找一找教程网

本站文章仅代表作者观点,不代表本站立场,所有文章非营利性免费分享。
本站提供了软件编程、网站开发技术、服务器运维、人工智能等等IT技术文章,希望广大程序员努力学习,让我们用科技改变世界。
[python3.5切换为python3.9后,执行pip3 install numpy报错]http://www.zyiz.net/tech/detail-228448.html

上一篇:python获取所在路径方法

下一篇:python数据结构

赞(0)
关注微信小程序
程序员编程王-随时随地学编程

扫描二维码或查找【程序员编程王】

可以随时随地学编程啦!

技术文章导航 更多>
扫一扫关注最新编程教程