[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升级到3.*,然后尝试
python[version] -m pip install Django
或者这是我认为对有用的答案
我遇到了同样的问题,之前的答案都没有为我解决
当我将python卸载并重新安装到我的电脑上时,出现了这个错误。因为以前存在的pip版本似乎没有完全删除,当我试图用python -m pip install package
导入它时,它实际上是在尝试调用以前的版本。
要首先解决此问题,请手动删除以下位置的pip文件夹:
C:Usersusernamepip
C:UsersusernameAppDataLocalpip
C:UsersusernameAppDataLocalProgramsPythonPython**libsite-packagespip***
C:Python**pip
然后下载get-pp.py.
最后,导航到下载它的文件夹并运行:
python get-pip.py
此过程应重新安装pip并解决问题。