linux安装python3

Posted wx63186321c235c

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了linux安装python3相关的知识,希望对你有一定的参考价值。


新建shell文件,installPython.sh

/bin/rm -fr /usr/local/python3
wget https://ftp.openssl.org/source/old/1.1.1/openssl-1.1.1j.tar.gz --no-check-certificate
tar xf openssl-1.1.1j.tar.gz
cd openssl-1.1.1j
./config --prefix=/usr/local/openssl-1.1.1j
make && make install
echo "/usr/local/openssl-1.1.1j/lib/" >/etc/ld.so.conf.d/openssl.conf
ldconfig

yum -y install libffi-devel
yum -y install zlib
yum -y install zlib-devel
wget https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tgz
tar -zxvf Python-3.7.0.tgz
cd Python-3.7.0
./configure prefix=/usr/local/python3 --with-openssl=/usr/local/openssl-1.1.1j
make && make install
/usr/local/python3/bin/python3 -V
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
/usr/local/python3/bin/python3 /opt/get-pip.py


/usr/local/python3/bin/pip3 install -i https://mirrors.aliyun.com/pypi/simple/ pyaml==19.12.0
/usr/local/python3/bin/pip3 install -i https://mirrors.aliyun.com/pypi/simple/ pycparser==2.19
/usr/local/python3/bin/pip3 install -i https://mirrors.aliyun.com/pypi/simple/ PyGithub==1.45
/usr/local/python3/bin/pip3 install -i https://mirrors.aliyun.com/pypi/simple/ PyJWT==1.7.1
/usr/local/python3/bin/pip3 install -i https://mirrors.aliyun.com/pypi/simple/ pymongo==3.10.1
/usr/local/python3/bin/pip3 install -i https://mirrors.aliyun.com/pypi/simple/ Pymysql==0.9.3
/usr/local/python3/bin/pip3 install -i https://mirrors.aliyun.com/pypi/simple/ smmap2==2.0.5
/usr/local/python3/bin/pip3 install -i https://mirrors.aliyun.com/pypi/simple/ soupsieve==2.0.1
/usr/local/python3/bin/pip3 install -i https://mirrors.aliyun.com/pypi/simple/ texttable==1.6.2
/usr/local/python3/bin/pip3 install -i https://mirrors.aliyun.com/pypi/simple/ urllib3==1.25.7
/usr/local/python3/bin/pip3 install -i https://mirrors.aliyun.com/pypi/simple/ websocket-client==0.48.0
/usr/local/python3/bin/pip3 install -i https://mirrors.aliyun.com/pypi/simple/ wrapt==1.11.2
/usr/local/python3/bin/pip3 install -i https://mirrors.aliyun.com/pypi/simple/ xlrd==1.2.0
/usr/local/python3/bin/pip3 install -i https://mirrors.aliyun.com/pypi/simple/ xlutils==2.0.0
/usr/local/python3/bin/pip3 install -i https://mirrors.aliyun.com/pypi/simple/ xlwt==1.3.0
/usr/local/python3/bin/pip3 install -i https://mirrors.aliyun.com/pypi/simple/ zipp==1.0.0
/usr/local/python3/bin/pip3 install -i https://mirrors.aliyun.com/pypi/simple/ pyautogui==0.9.52

yum -y install libSM-1.2.2-2.el7.x86_64 --setopt=protected_multilib=false

脚本里安装python和pip是全的,

下面安装python依赖,需要更换成自己需要的依赖包。

运行shell脚本

sh installPyhton.sh

以上是关于linux安装python3的主要内容,如果未能解决你的问题,请参考以下文章

Linux安装python3.6.2

Linux 安装 python3.6

linux环境快速安装python3

Linux(Centos)下安装python3

linux 安装 python3

Linux下安装Python3