Kali环境下安装Python3.7

目前面临的问题,在kali操作系统中默认安装了python2和python3,但是pip命令所安装的库都在python2里面,无法引入python3

这就导致使用python3 代码引用第三方库存在问题,故通过源码安装python3.7来解决问题。

首先下载python3.7

wget https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tgz

解压并新建安装python环境的目录

tar -zxvf Python-3.7.0.tgz

编译之前,安装一些所要依赖的包

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

假如报错了,就删除对应的lock
rm /var/cache/apt/archives/lock

编译安装

./configure --enable-optimizations --prefix=/usr/local/Python-3.7/ && make && make install

 

建立软连接

ln -s -b /usr/local/python3.7/bin/python3.7 /usr/bin/python
ln -s -b /usr/local/python3.7/bin/pip3 /usr/bin/pip3

 

 

 

 
posted @ 2020-03-05 00:08  komomon  阅读(11999)  评论(0编辑  收藏  举报