[root@VM-4-13-centos ~]# python -m pip install Django
/bin/python: No module named typing; 'pip' is a package and cannot be directly executed
[root@VM-4-13-centos ~]# sudo apt install python-pip python3-pip
sudo: apt: command not found
[root@VM-4-13-centos ~]# sudo yum install python-pip python3-pip
Loaded plugins: fastestmirror, langpacks
Repository epel is listed more than once in the configuration
Loading mirror speeds from cached hostfile
Package python2-pip-8.1.2-14.el7.noarch already installed and latest version
Package python3-pip-9.0.3-8.el7.noarch already installed and latest version
Nothing to do
[root@VM-4-13-centos ~]# python -m pip install Django
/bin/python: No module named typing; 'pip' is a package and cannot be directly executed
pip install Django
python[version] -m pip install Django
Or here is the answer which I find helpful
I had the same issue and none of the previous answers solved it for me.
The error appeared when I uninstalled and reinstalled python to my PC. As it appears the previously existing version of pip wasn't completely removed and when I was trying to import it with python -m pip install package
it was actually trying to call the previous version.
To solve it first manually delete the pip folders in the following locations:
C:\Users\username\pip
C:\Users\username\AppData\Local\pip
C:\Users\username\AppData\Local\Programs\Python\Python**\lib\site-packages\pip***
C:\Python**\pip
Then download get-pip.py.
Finally, navigate to the folder where you downloaded it and run:
python get-pip.py
This procedure should reinstall pip and fix the issue.