I created the following alias to run pip3.7
everytime I use pip
command:
pip='pip3.7'
Now, bash says:
pip -V pip 18.1 from /home/uname/.local/lib/python3.7/site-packages/pip (python 3.7)
but, the command which pip
says:
which pip /home/uname/.local/bin/pip
while the executables for pip3.7 seem to be located at different folders:
whereis pip3.7: /usr/local/bin/pip3.7 /home/uname/.local/bin/pip3.7 /home/uname/.local/bin/pip3
I think maybe that in which pip
, the world pip
is not seen as the command actually triggered by the alias, thus it returns the pip path like if alias would not exist. This confuses me on which version actually runs with pip
command.
which
can only find executables in the PATH.type
is a Bash builtin, and will show aliases, plus other Bash-internal commands like functions, keywords, and builtins, plus executables and hashed executables.Example shell session:
It depends what python interpreter you want to use. You can install same python and pip several times on one machine.
If you want to use standard python like
then you can set alias as
If you want to use a different installation of python I recommend using python virtual environment. You can install it with
You can also find several tutorials in internet on how to use python virtual environment.