0

How do I install packages such as python3, and use them under a different name like python?

5
  • 5
    what are you actually trying to achieve? what you propose is a baaaad idea imho
    – Zanna
    Mar 17, 2017 at 18:02
  • I want to use the python3 and pip3 command as python and pip Mar 17, 2017 at 18:03
  • 2
    if you REALLY want to do that, you can make an alias in your ~/.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
    – Zanna
    Mar 17, 2017 at 18:06
  • 3
    askubuntu.com/questions/320996/…
    – rohit15079
    Mar 17, 2017 at 18:07
  • Please flesh out your question and explain what you are really trying to accomplish, and you might get better answers.
    – SDsolar
    Mar 18, 2017 at 0:15

2 Answers 2

1

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
1
  • Does it work for all packages? Suppose, I want to use libusb-1.0-0 as libusb-1.0. Can I use the same method? Jul 2, 2022 at 10:11
0

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.

Not the answer you're looking for? Browse other questions tagged .