一 安装python3.6
1.创建目录
sudo mkdir /usr/local/python3
2.下载源文件
wget https://www.python.org/ftp/python/3.6.5/Python-3.6.5.tgz
//这个就是相当于从网络上下载zip
3.解压源文件
tar -xzvf Python-3.6.5.tgz
//解压
4.编译
4.1 首先进入目录里面
cd Python-3.6.5
4.2 编译
sudo ./configure --prefix=/usr/local/python3
//指定目录
5.安装
sudo make
sudo make install
6.创建软连接
sudo ln -s /usr/local/python3/bin/python3 /usr/bin/python3
二 解决python2python3冲突问题
1.修改yum配置文件,将python版本指向以前的旧版本
vi /usr/bin/yum
把第一行改成#!/usr/bin/python2.7
2.修改urlgrabber-ext-down文件,更改python版本
vi /usr/libexec/urlgrabber-ext-down
把第一行改成#!/usr/bin/python2.7
三 安装zib
1.安装zlib依赖
yum install zlib yum -y install zlib*
2.重新去编译一遍Python-3.6.5
sudo ./configure --prefix=/usr/local/python3 # 指定创建的目录
sudo make
sudo make install
四 安装setuptools-39.1.0
cd /root
wget https://files.pythonhosted.org/packages/a6/5b/f399fcffb9128d642387133dc3aa9bb81f127b949cd4d9f63e5602ad1d71/setuptools-39.1.0.zip
unzip setuptools-39.1.0.zip
cd setuptools-39.1.0
python setup.py install
五 安装升级pip
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python get-pip.py
python3 -m pip install --upgrade pip
六 安装model
python3 -m pip install requests
python3 -m pip install BeautifulSoup4
python3 -m pip install numpy
python3 -m pip install pandas
python3 -m pip install time
python3 -m pip install re
python3 -m pip install datetime
python3 -m pip install baidu-aip
python3 -m pip install prettytable
python3 -m pip install pymysql
python3 -m pip install pycode_similar
python3 -m pip install lxml
python3 -m pip install pyperclip
python3 -m pip install uiautomator
python3 -m pip install opencv-python
python3 -m pip install matching
python3 -m pip install pillow
七 运行python3文件
python3 yourpython.py
https://blog.csdn.net/a1023182899/article/details/90483742 原文链接