1、安装所需依赖zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel libffi-devel
执行rpm -ivh bzip2-devel-1.0.6-29.fc30.aarch64.rpm –nodeps –force
进行安装。其他依赖包同理。依赖包在python_aarch64文件夹下。下载地址http://rpmfind.net/linux/rpm2html/search.php?query=libpcap-devel%28aarch-64%29&submit=Search+…&system=&arch= 下载时,选择fc30那个版本的。
2、将Python-3.7.0.tgz上传至中标麒麟机器上
3、执行tar -zxvf Python-3.7.0.tgz
解压。
4、新建文件夹 mkdir /usr/local/python3
5、将解压后的安装包移植到新文件夹
cd /usr/local/software
mv Python-3.7.0 /usr/local/python3
6、执行配置文件,编译,编译安装
cd /usr/local/python3/Python-3.7.0
./configure --prefix=/usr/local/python3
make && make install
7、建立软连接
mv /usr/bin/python /usr/bin/python_bak #先备份之前的python2
ln -s /usr/local/python3/bin/python3.7 /usr/bin/python
ln -s /usr/local/python3/bin/pip3.7 /usr/bin/pip
8、测试一下python3是否可以用
[root@mini Python-3.7.0]# python
Python 3.7.0 (default, Jul 28 2018, 22:47:29)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-28)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> print("hello world!")
hello world!
>>> exit()
[root@mini Python-3.7.0]# pip3 --version
pip 10.0.1 from /usr/local/python3/lib/python3.7/site-packages/pip (python 3.7)