[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
或者这是我觉得有帮助的答案
我有同样的问题,以前的答案都没有为我解决。
当我将 python 卸载并重新安装到我的 PC 时,出现了错误。看起来以前存在的 pip 版本并没有完全删除,当我尝试使用
python -m pip install package
导入它时它实际上是在尝试调用以前的版本。先解决手动删除以下位置的 pip 文件夹:
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
然后下载get-pip.py .最后,导航到您下载它的文件夹并运行:
python get-pip.py
此过程应重新安装 pip 并解决问题。
关于server -/bin/python : No module named typing; 'pip' is a package and cannot be directly executed,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67837534/