简体   繁体   中英

change the default version of python in kali linux

tried to install sherlock for installing sherlock python 3.6 or more required, i installed python 3.8.2.But the default version is not changed it remain as python 2.7.17.

Just taking the needed part from @George Oyosa's answer

update-alternatives --install /usr/bin/python python /usr/bin/python3.8 2

Just execute it and the the command update-alternatives will handle the rest for you.

Here is a link that may help . Check it out: Basically:

  1. Check your existing python version by running:

    python -V

    or

    python --version

  2. List all the available items by running:

    ls /usr/bin/python

  3. Now, set your version priorities by issuing the following commands:

    update-alternatives --install /usr/bin/python python /usr/bin/python2.7 1

    update-alternatives --install /usr/bin/python python /usr/bin/python3.8 2

  4. You can then list the python priorities by:

    update-alternatives --config python

  5. Finally, check your default python version to confirm by repeating the first step!

I have included a screenshot of the same. Check it out. Change Default Python Version Priority.png

Simply open terminal and run "alias python=python3" (without the quotes) then run "python -V" to check

sudo apt install -y python-is-python3

As explain here: Everything you need to know about the switch to Python 3

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM