The Python2.x switched to the kali Python3.x

1, first create a Python-3.6 in / usr / local / under

mkdir /usr/local/Python-3.6

2, the installation package to drag / home and extract

3, add the update source update

gedit /etc/apt/sources.list

Attached: official update source:

deb http://http.kali.org/kali kali-rolling main non-free contrib
deb-src http://http.kali.org/kali kali-rolling main non-free contrib

4, mounted reliance

apt-get install -y make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev xz-utils tk-dev

5, compile and install

./configure --prefix=/usr/local/Python-3.6/

or

--enable-optimizations --prefix = ./configure / usr / local / Python - 3.6 / - used the --enable-optimizations installation failure occurs, do not know the specific reasons

--enable-optimizations for the optimal installation --prefix declaration installation path

make - Compile
the make  install - compile and install

5, create a soft link
① back up previous Python

mv / usr / bin / python / usr / bin / python_bk

② create a new Python link

ln -s /usr/local/python3/bin/python3 /usr/bin/python

6, can not be used to solve the problem pip
use the command

python -m ensurepip
python -m pip install

Reference website:
https://blog.csdn.net/Dolorous_yuanshao/article/details/80380488

kali latest version seems to have Python3.x

Specific operation to see if there is kali your version Python3.x

I used the command:

 

root@kali:~# mv /usr/bin/python /usr/bin/python2
root@kali:~# ln -s /usr/bin/python3 /usr/bin/python
root@kali:~# mv /usr/bin/python-config /usr/bin/python2-config
root@kali:~# ln -s /usr/bin/python3-config /usr/bin/python-config

 

Guess you like

Origin www.cnblogs.com/liuguojun/p/11023561.html