当前位置:   article > 正文

ubuntu18.04 python3.6切换为python3.9后,执行pip3 install numpy报错_file "/usr/local/lib/python3.9/site-packages/pip/_

file "/usr/local/lib/python3.9/site-packages/pip/_internal/cli/base_command.
  1. joes@joes:~$ pip3 install numpy
  2. Defaulting to user installation because normal site-packages is not writeable
  3. ERROR: Exception:
  4. Traceback (most recent call last):
  5. File "/usr/local/python3/lib/python3.9/site-packages/pip/_internal/cli/base_command.py", line 188, in _main
  6. status = self.run(options, args)
  7. File "/usr/local/python3/lib/python3.9/site-packages/pip/_internal/cli/req_command.py", line 185, in wrapper
  8. return func(self, options, args)
  9. File "/usr/local/python3/lib/python3.9/site-packages/pip/_internal/commands/install.py", line 278, in run
  10. session = self.get_default_session(options)
  11. File "/usr/local/python3/lib/python3.9/site-packages/pip/_internal/cli/req_command.py", line 83, in get_default_session
  12. self._session = self.enter_context(self._build_session(options))
  13. File "/usr/local/python3/lib/python3.9/site-packages/pip/_internal/cli/req_command.py", line 93, in _build_session
  14. session = PipSession(
  15. File "/usr/local/python3/lib/python3.9/site-packages/pip/_internal/network/session.py", line 249, in __init__
  16. self.headers["User-Agent"] = user_agent()
  17. File "/usr/local/python3/lib/python3.9/site-packages/pip/_internal/network/session.py", line 132, in user_agent
  18. zip(["name", "version", "id"], distro.linux_distribution()),
  19. File "/usr/local/python3/lib/python3.9/site-packages/pip/_vendor/distro.py", line 125, in linux_distribution
  20. return _distro.linux_distribution(full_distribution_name)
  21. File "/usr/local/python3/lib/python3.9/site-packages/pip/_vendor/distro.py", line 681, in linux_distribution
  22. self.version(),
  23. File "/usr/local/python3/lib/python3.9/site-packages/pip/_vendor/distro.py", line 741, in version
  24. self.lsb_release_attr('release'),
  25. File "/usr/local/python3/lib/python3.9/site-packages/pip/_vendor/distro.py", line 903, in lsb_release_attr
  26. return self._lsb_release_info.get(attribute, '')
  27. File "/usr/local/python3/lib/python3.9/site-packages/pip/_vendor/distro.py", line 556, in __get__
  28. ret = obj.__dict__[self._fname] = self._f(obj)
  29. File "/usr/local/python3/lib/python3.9/site-packages/pip/_vendor/distro.py", line 1014, in _lsb_release_info
  30. stdout = subprocess.check_output(cmd, stderr=devnull)
  31. File "/usr/local/python3/lib/python3.9/subprocess.py", line 420, in check_output
  32. return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  33. File "/usr/local/python3/lib/python3.9/subprocess.py", line 524, in run
  34. raise CalledProcessError(retcode, process.args,
  35. subprocess.CalledProcessError: Command '('lsb_release', '-a')' returned non-zero exit status 1.
  36. Traceback (most recent call last):
  37. File "/usr/local/bin/pip3", line 8, in <module>
  38. sys.exit(main())
  39. File "/usr/local/python3/lib/python3.9/site-packages/pip/_internal/cli/main.py", line 75, in main
  40. return command.main(cmd_args)
  41. File "/usr/local/python3/lib/python3.9/site-packages/pip/_internal/cli/base_command.py", line 114, in main
  42. return self._main(args)
  43. File "/usr/local/python3/lib/python3.9/site-packages/pip/_internal/cli/base_command.py", line 226, in _main
  44. self.handle_pip_version_check(options)
  45. File "/usr/local/python3/lib/python3.9/site-packages/pip/_internal/cli/req_command.py", line 152, in handle_pip_version_check
  46. session = self._build_session(
  47. File "/usr/local/python3/lib/python3.9/site-packages/pip/_internal/cli/req_command.py", line 93, in _build_session
  48. session = PipSession(
  49. File "/usr/local/python3/lib/python3.9/site-packages/pip/_internal/network/session.py", line 249, in __init__
  50. self.headers["User-Agent"] = user_agent()
  51. File "/usr/local/python3/lib/python3.9/site-packages/pip/_internal/network/session.py", line 132, in user_agent
  52. zip(["name", "version", "id"], distro.linux_distribution()),
  53. File "/usr/local/python3/lib/python3.9/site-packages/pip/_vendor/distro.py", line 125, in linux_distribution
  54. return _distro.linux_distribution(full_distribution_name)
  55. File "/usr/local/python3/lib/python3.9/site-packages/pip/_vendor/distro.py", line 681, in linux_distribution
  56. self.version(),
  57. File "/usr/local/python3/lib/python3.9/site-packages/pip/_vendor/distro.py", line 741, in version
  58. self.lsb_release_attr('release'),
  59. File "/usr/local/python3/lib/python3.9/site-packages/pip/_vendor/distro.py", line 903, in lsb_release_attr
  60. return self._lsb_release_info.get(attribute, '')
  61. File "/usr/local/python3/lib/python3.9/site-packages/pip/_vendor/distro.py", line 556, in __get__
  62. ret = obj.__dict__[self._fname] = self._f(obj)
  63. File "/usr/local/python3/lib/python3.9/site-packages/pip/_vendor/distro.py", line 1014, in _lsb_release_info
  64. stdout = subprocess.check_output(cmd, stderr=devnull)
  65. File "/usr/local/python3/lib/python3.9/subprocess.py", line 420, in check_output
  66. return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  67. File "/usr/local/python3/lib/python3.9/subprocess.py", line 524, in run
  68. raise CalledProcessError(retcode, process.args,
  69. subprocess.CalledProcessError: Command '('lsb_release', '-a')' returned non-zero exit status 1.

解决方法:

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

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/AllinToyou/article/detail/506917
推荐阅读
相关标签
  

闽ICP备14008679号