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