如何将 pip3 命令更改为 pip? [英] How to change pip3 command to be pip?

查看:156
本文介绍了如何将 pip3 命令更改为 pip?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我卸载了 pip,而是安装了 pip3.现在,我只想通过键入 pip 来使用 pip3.原因是我习惯只输入pip,每个向导都使用pip命令,所以每次要复制粘贴命令时,都得修改pippip3 浪费时间.当我输入 pip 时,我有一个错误是 pip: command not found 这意味着 pip 命令没有被采用.是否可以让 pip 指向 pip3?

I uninstalled pip, and I installed pip3 instead. Now, I want to use pip3 by typing pip only. The reason is I am used to type pip only and every guide uses the pip command, so every time I want to copy and paste commands, I have to modify pip to pip3 which wastes time. When I type pip I have an error which is pip: command not found which means pip command is not taken. Is it possible to make pip points to pip3?

推荐答案

你可以给你的 ~/.bashrc 添加别名

you can either add alias to your ~/.bashrc

alias pip=pip3

或添加到名为 pip 的 $PATH 符号链接,指向 pip3 二进制文件

or add to your $PATH symlink named pip pointing to pip3 binary

(顺便说一句,这虽然关于​​ pip 并不是真正与 python 相关的问题,所以你应该重新标记它)

(btw, this even though concerning pip isn't really python related question, so you should retag it)

更新:2020 年 7 月

如果你的macOS主目录下没有~/.bashrc,输入

If there is no ~/.bashrc in your home directory on macOS, inputting

alias pip=pip3

在你的 ~/.zprofile 文件中也有同样的效果,

in your ~/.zprofile file has the same effect,

这篇关于如何将 pip3 命令更改为 pip?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆