Kali 2018.1编译安装Python3.7

1.1 下载Python-3.7源码包

root@kali:/home# python -V
Python 2.7.14+
root@kali:/home# wget https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tgz

1.2 解压安装

root@kali:/home# ls -l
total 22224
-rw-r--r-- 1 root root 22745726 Jun 27 14:06 Python-3.7.0.tgz
root@kali:/home# tar -zxvf Python-3.7.0.tgz 
root@kali:/home# mkdir /usr/local/Python-3.7
root@kali:/home# cd Python-3.7.0/
root@kali:/home/Python-3.7.0# ./configure --enable-optimizations --prefix=/usr/local/python3.7/
root@kali:/home/Python-3.7.0# make && make install

1.3 安装报错,安装依赖包继续

Kali 2018.1编译安装Python3.7_第1张图片

## 安装依赖包
root@kali:/home# 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
## 如果报错,删除锁文件,继续执行安装
## root@kali:/home/Python-3.7.0# rm /var/cache/apt/archives/lock 
## 继续编译安装
root@kali:/home/Python-3.7.0# make install
	......
	......
Collecting setuptools
Collecting pip
Installing collected packages: setuptools, pip
Successfully installed pip-10.0.1 setuptools-39.0.1

1.4 安装完成,测试

root@kali:/home# python -V
Python 2.7.14+
root@kali:/# ls -l /usr/bin/python
lrwxrwxrwx 1 root root 9 9月  26 10:46 /usr/bin/python -> python2.7
root@kali:/# ln -s -b /usr/local/python3.7/bin/python3.7 /usr/bin/python 
root@kali:/# python
Python 3.7.0 (default, Sep 26 2018, 12:17:46) 
[GCC 7.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> print('hello world')
hello world
>>> exit()

你可能感兴趣的:(linux,python,kali,python3.7)