How do I install packages such as python3
, and use them under a different name like python
?
2 Answers
As explained by Zanna in comments, this is a workaround, but you might want to set an alias in your .bashrc
file.
Open file :
gedit ~/.bashrc
Add this at the end :
alias python="python3"
alias pip="pip3"
Save and exit, then :
source .bashrc
Then you can use the new aliases inside terminal instead of actual command:
python -V
>>> Python 3.6.0
-
Does it work for all packages? Suppose, I want to use
libusb-1.0-0
aslibusb-1.0
. Can I use the same method? Jul 2, 2022 at 10:11
You can't actually do that. When you install it, it'll go where it belongs.
@Zanna points to a similar question about changing symlinks but then it goes on to explain how that will have ripple effects across the system where it is assumed those symlinks point to Python 2.
This is a slightly interesting question, but I have searched and cannot find a business case for doing this, and have found many reasons why it probably would break your system if you succeeded. Time spent for a negative result is not good business.
If you want to try working on this I suggest you do it in a VM instead of on a live, functioning system.
~/.bashrc
, which is not advisable but probably not unsafe, as it will only affect interactive shells. Any deeper changes you make will just mess up your system. Lots of essential programs look for "python" and need to find python2 when they do, otherwise they will not work