简体   繁体   English

在kali linux中更改python的默认版本

[英]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.尝试安装 sherlock以安装 sherlock python 3.6 或更高版本,我安装了 python 3.8.2。但默认版本没有更改,它保持为 python 2.7。

Just taking the needed part from @George Oyosa's answer只需从@George Oyosa 的回答中获取所需的部分

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.只需执行它,命令update-alternatives将为您处理 rest。

Here is a link that may help .这是一个可能有帮助的链接 Check it out: Basically:检查一下: 基本上:

  1. Check your existing python version by running:通过运行检查您现有的 python 版本:

    python -V python -V

    or或者

    python --version python --版本

  2. List all the available items by running:通过运行列出所有可用的项目:

    ls /usr/bin/python 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/python2.7 1

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

  4. You can then list the python priorities by:然后,您可以通过以下方式列出 python 优先级:

    update-alternatives --config python更新替代品--config python

  5. Finally, check your default python version to confirm by repeating the first step!最后,通过重复第一步检查您的默认 python 版本以确认!

I have included a screenshot of the same.我已经包含了相同的屏幕截图。 Check it out.一探究竟。 Change Default Python Version Priority.png更改默认 Python 版本优先级.png

Simply open terminal and run "alias python=python3" (without the quotes) then run "python -V" to check只需打开终端并运行“alias python=python3”(不带引号)然后运行“python -V”来检查

sudo apt install -y python-is-python3

As explain here: Everything you need to know about the switch to Python 3如下所述:关于切换到 Python 3 您需要了解的一切

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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