环境部署
我们在pycharm上都是自己设置的python3解释器的环境变量,使得代码能够正常执行!可是怎么能让我们的python代码在LINUX上跑起来呢? linux是内置python,可是内置的是python2哦,python2在2020年就不维护了,所以python3必然大趋所示,哈哈,还是说怎么部署python3环境吧!!!!
安装python3步骤
- 1.首先解决依赖环境,这个特别重要
#### ---yum 安装以下依赖--- ####
# yum -y groupinstall "Development tools"
# yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel
# yum install libffi-devel -y - 2.下载地址:https://www.python.org/ftp/python/3.6.2/Python-3.6.2.tgz
wget https://www.python.org/ftp/python/3.6.2/Python-3.6.2.tgz #直接执行
- 3.下载压缩包后解压它
tar -xvf Python-3.6.2.tgz #解压后显示一个Python-3.6.2的目录/文件夹
- 4.开始编译安装
# mkdir -p /usr/local/python3 #创建编译安装目录
# cd Python-3.6.2
# ./configure --prefix=/usr/local/python3
# make && make install - 5.创建软连接
# ln -s /usr/local/python3/bin/python3 /usr/local/bin/python3
# ln -s /usr/local/python3/bin/pip3 /usr/local/bin/pip3 - 验证
# python3 -V
# pip3 -V
pip 安装第三方库
#清华源普遍安装速度较快
# pip install -i https://pypi.tuna.tsinghua.edu.cn/simple xxx