[How to Solve] ImportError: No module named typing

python version 2.7
Error
This error occurs when using pip

Traceback (most recent call last):
File “C:\Python27\Scripts\pip-script.py”, line 9, in
load_entry_point(‘pip==21.1.3’, ‘console_scripts’, ‘pip’)()
File “C:\Python27\lib\site-packages\pkg_resources_init_.py”, line 542, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File “C:\Python27\lib\site-packages\pkg_resources_init_.py”, line 2569, in load_entry_point
return ep.load()
File “C:\Python27\lib\site-packages\pkg_resources_init_.py”, line 2229, in load
return self.resolve()
File “C:\Python27\lib\site-packages\pkg_resources_init_.py”, line 2235, in resolve
module = import(self.module_name, fromlist=[‘name’], level=0)
File “C:\Python27\lib\site-packages\pip_init_.py”, line 1, in
from typing import List, Optional
ImportError: No module named typing

The solution is to update python to 3, but I want to use 2.7, so this method does not work
Solution
I found that the version of pip is too high, and it is not compatible with python2, my version is pip21.1.3, so I need to set back the version of pip, the solution is as follows, just run it in order

curl -O https://bootstrap.pypa.io/pip/2.7/get-pip.py
python get-pip.py
python -m pip install --upgrade "pip < 21.0"

Perfect solution, PIP version back, install again without error correction


Read More: