全栈工程师_java全栈工程师_全栈开发者学习经验总结

  • 首页
  • 开发工具
    • 软件安装
    • 软件使用
  • 前端
    • Ionic
    • Android
    • Capacitor
    • Angular
    • Vue
    • 苹果开发者账号
  • 后端
    • Java
    • Python
    • MyBatis
    • Spring
    • SpringBoot
    • SpringMVC
    • SpringCloud
  • 服务器
    • Linux
    • MySQL
    • Nginx
    • Tomcat
    • Docker
  • 其他
    • 生活碎片
    • 报错专区
  • 我
lipsuper
专注产出高质量原创手打文章
  1. 首页
  2. 其他
  3. 报错专区
  4. 正文

Python报错解决Command 'pip' not found, but there are 18 similar ones

2020年10月13日 7459点热度 46人点赞 0条评论

本文基于Ubuntu20.04操作系统,相关命令是该系统特有,请注意甄别。

 

今天要给Python安装一个外部的模块,于是按照老师的方法,使用pip命令进行安装,结果一运行安装命令就出现了如下报错:

Command 'pip' not found, but there are 18 similar ones.

 

在网上找到的答案:

The different versions of Python are not surprising. WSL is, effectively, an ultra-lightweight virtual machine. Your Windows python installation is entirely independent of the WSL python installation.

Python has two widely used major versions, Python 2 and Python 3. The command python runs some minor version of Python 2, while the command python3 runs some minor version of Python 3. Below is my console output.

lawruble@Balrog:~/scratch$ python --version
Python 2.7.18
lawruble@Balrog:~/scratch$ python3 --version
Python 3.8.5

Pip is the python installation manager, and has the same major versions as Python. The command pip runs the Python 2 version of pip, while pip3 runs the Python 3 version of pip.

It's better practice to use python3 -m pip over pip3, it helps ensure that you're using the version of pip associated with the version of python you expect to run.

他的意思大概就是说要看一下自己使用的是什么版本的Python,如果用的是Python2的话,就可以使用pip命令。但是如果你安装的是Python3的话,就要使用pip3这个命令来安装。

 

看来我的情况跟他描述是一样的,我的确是系统默认安装的python3.8。然后我就试一试pip3,结果还是报错:

Command 'pip3' not found, but can be installed with:

sudo apt install python3-pip

 

原来我报错的原因是我根本就还没有安装pip3呢,不过好在它提示我可以安装,于是我就使用下面的命令安装了:

sudo apt install python3-pip

 

再次运行pip3安装模块,一切正常了。

 

Python小白之路,幼稚的问题可真多!

本作品采用 知识共享署名 4.0 国际许可协议 进行许可
标签: 报错
最后更新:2020年10月13日

lipsuper

这个人很懒,什么都没留下

点赞
< 上一篇
下一篇 >

文章评论

取消回复

COPYRIGHT © 2021 lipsuper.com. ALL RIGHTS RESERVED.

Theme Kratos Made By Seaton Jiang

渝ICP备2021004735号-1

渝公网安备 50011202502306号