简体   繁体   English

从 3.6 更新后无法为 python 3.7 安装 pip

[英]Unable to install pip for python 3.7 after updating from 3.6

I recently tried to upgrade my python 3.6 to pyhon 3.7 follwing the instruction here:我最近尝试按照此处的说明将我的 python 3.6 升级到 pyhon 3.7:

https://askubuntu.com/questions/1086649/how-to-update-python-to-the-latest-version-on-ubuntu-18-04 https://askubuntu.com/questions/1086649/how-to-update-python-to-the-latest-version-on-ubuntu-18-04

Now, I'm trying to install pip for python 3.7现在,我正在尝试为 python 3.7 安装 pip

python3.7 -m pip install pip

I get an error:我收到一个错误:

OFPEPFE
Traceback (most recent call last):
  File "/usr/lib/python3.7/runpy.py", line 183, in _run_module_as_main
    mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
  File "/usr/lib/python3.7/runpy.py", line 142, in _get_module_details
    return _get_module_details(pkg_main_name, error)
  File "/usr/lib/python3.7/runpy.py", line 109, in _get_module_details
    __import__(pkg_name)
  File "/usr/lib/python3/dist-packages/pip/__init__.py", line 22, in <module>
    from pip._vendor.requests.packages.urllib3.exceptions import DependencyWarning
  File "/usr/lib/python3/dist-packages/pip/_vendor/__init__.py", line 61, in <module>
    sys.path[:] = glob.glob(os.path.join(WHEEL_DIR, "*.whl")) + sys.path
AttributeError: module 'glob' has no attribute 'glob'
Error in sys.excepthook:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 63, in apport_excepthook
    from apport.fileutils import likely_packaged, get_recent_crashes
  File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in <module>
    from apport.report import Report
  File "/usr/lib/python3/dist-packages/apport/report.py", line 21, in <module>
    from urllib.request import urlopen
  File "/usr/lib/python3.7/urllib/request.py", line 88, in <module>
    import http.client
  File "/usr/lib/python3.7/http/client.py", line 71, in <module>
    import email.parser
ModuleNotFoundError: No module named 'email.parser'; 'email' is not a package

Original exception was:
Traceback (most recent call last):
  File "/usr/lib/python3.7/runpy.py", line 183, in _run_module_as_main
    mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
  File "/usr/lib/python3.7/runpy.py", line 142, in _get_module_details
    return _get_module_details(pkg_main_name, error)
  File "/usr/lib/python3.7/runpy.py", line 109, in _get_module_details
    __import__(pkg_name)
  File "/usr/lib/python3/dist-packages/pip/__init__.py", line 22, in <module>
    from pip._vendor.requests.packages.urllib3.exceptions import DependencyWarning
  File "/usr/lib/python3/dist-packages/pip/_vendor/__init__.py", line 61, in <module>
    sys.path[:] = glob.glob(os.path.join(WHEEL_DIR, "*.whl")) + sys.path
AttributeError: module 'glob' has no attribute 'glob'

How do I fix this?我该如何解决?

run the following to update your package list:运行以下命令来更新您的软件包列表:

sudo apt update

then install pip然后安装pip

sudo apt install python3.7-pip

check that it is correct:检查它是否正确:

pip3 --version

or more specifically you should be able to:或更具体地说,您应该能够:

pip3.7 --version

pip 9.0.1 from /usr/lib/python3/dist-packages (python 3.7)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM