Home > Net >  Python Multiple version installation in Linux rocky
Python Multiple version installation in Linux rocky

Time:07-22

I am new to Python and Linux env, so a little confused. I want to find where my Python3.9 is installed, so that I can update the PATH..

  • Running python --version or python3 --version give me Python 3.6.8

  • I want to install Python 3.9, so when I run sudo dnf install -y python39 it gives me

  • Package python39-3.9.12-1ep1.el8.x86_64 is already installed.

  • ls /usr/bin/python* doesn't show 3.9

  • Output of above command - /usr/bin/python /usr/bin/python3 /usr/bin/python3.6 /usr/bin/python3.6m

  • Also tried alternatives --config python but it shows only 3.6

      -----------------------------------------------
       *  1           /usr/libexec/no-python
          2           /usr/bin/python3
    
  • which python3.6 gives /usr/bin/python3.6

  • which python3.9 gives /usr/bin/which: no python3.9 in....

  • rpm -ql python39-3.9.12-1ep1.el8.x86_64 gives me

  • /etc/gdbinit.d/python39.gdb. /opt/python3.9. /opt/python3.9/bin

I could be missing something obvious, if someone can point me in the right direction it will be awesome.

CodePudding user response:

what happens when you enter the following command: python3 --version and is it any different compared to running python --version?

CodePudding user response:

I am not sure what is your actual requirement is. But if you have already installed python 3.9 in your machine, then you can have this and all previous versions applied to different projects. This is selected when you create virtual environments. For example if you want to run a project that built on 3.6, then you can select python interpreter 3.6 at the time of creation.

CodePudding user response:

So the virtual machine I was working was built using vagrant, it had python 3.6 in usr/bin and python 3.9 in opt/python3.9. Newbie like me who wanna understand what /opt is - https://www.baeldung.com/linux/opt-directory

To search any package used command - rpm -ql python39-3.9.12-1ep1.el8.x86_64

Once package is found add it to path as symlinking binaries can be confusing vim ~/.bashrc PATH=/opt/python3.9/bin

  • Related