How to change pip3 command to be pip?

前端 未结 9 2463
梦毁少年i
梦毁少年i 2020-12-04 23:33

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 t

相关标签:
9条回答
  • 2020-12-05 00:07

    Copy the pip3 file and rename as pip:

    sudo cp /usr/bin/pip3 /usr/bin/pip
    pip --version 
    

    and

    pip3 --version 
    

    Works now.

    0 讨论(0)
  • 2020-12-05 00:09

    you can either add alias to your ~/.bashrc

    alias pip=pip3
    

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

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

    Update: July 2020

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

    alias pip=pip3
    

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

    0 讨论(0)
  • 2020-12-05 00:09

    Since you uninstalled pip, this solution assumes you're only going to use pip3.

    1. Open your terminal.

    2. Create a simple link. To do that type:

      sudo ln -s /usr/bin/pip3 /usr/bin/pip

    Now when you type pip, it will invoke pip3.

    Check that it worked by typing pip --version

    pip --version   
    pip 9.0.1 from /usr/lib/python3/dist-packages (python 3.6)
    

    You're all set!

    0 讨论(0)
提交回复
热议问题