【问题标题】:/bin/python: No module named typing; 'pip' is a package and cannot be directly executed/bin/python:没有名为 typing 的模块; 'pip' 是一个包,不能直接执行
【发布时间】:2021-08-22 12:37:11
【问题描述】:
[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

【问题讨论】:

    标签: server centos


    【解决方案1】:
    1. 尝试运行pip install Django
    2. 或者升级python到3.*的东西然后试试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 并解决问题。

    【讨论】:

      猜你喜欢
      • 2017-11-16
      • 2020-04-08
      • 2021-06-12
      • 2019-01-15
      • 2018-11-23
      • 2016-01-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多