linux python-3.10.4 安装
一、準備安裝包
openssl-1.1.1n.tar.gz
百度鏈接:https://pan.baidu.com/s/1NflkHmUdeefj1rZoN48Cmw?
提取碼:6jxe??
官網(wǎng):
https://www.openssl.org/python-3.10.4 需要1.1.1及以上版本,例如:openssl-1.1.1a.tar.gz,1a有可能是1n,別慌,官網(wǎng)上的用著放心,版本對就行了
libressl-3.5.1.tar.gz
鏈接:https://pan.baidu.com/s/1pmswJSgmGLZRUtEQ4fzsAg?
提取碼:4mmw
Python-3.10.4.tgz
鏈接:https://pan.baidu.com/s/13tM-g3fi9dKZ9TAsZS3uxw?
提取碼:tf2w
二、安裝OpenSSL
先看下OpenSSL 的版本是否符合要求:
[root@pghost5 ~]# openssl version?python-3.10.4要求的版本是1.1.1及以上版本,因為原先的不滿足,所以重新安裝:
[root@pghost5 ~]# tar xzvf openssl-1.1.1n.tar.gz [root@pghost5 ~]# cd openssl-1.1.1n [root@pghost5 openssl-1.1.1n]# ./config --prefix=/usr/local/openssl shared [root@pghost5 openssl-1.1.1n]# make [root@pghost5 openssl-1.1.1n]# make install這幾句命令執(zhí)行完了,應該是裝好了,那我們驗證下是否是安裝好的:
[root@pghost5 ~]# openssl version如果出來正常版本號,就是對的,我是沒有報錯的;
如果掛錯:
openssl: error while loading shared libraries: libssl.so.1.1: cannot open shared object file: No such file or directory
則執(zhí)行如下語句解決:
[root@pghost5 ~]# ln -s /usr/local/opensslbbssl.so.1.1 /usrb64bssl.so.1.1 [root@pghost5 ~]# ln -s /usr/local/opensslbbcrypto.so.1.1 /usrb64bcrypto.so.1.1?執(zhí)行完,再次驗證即可。
三、安裝LibreSSL
[root@pghost5 ~]# tar xzvf libressl-3.5.1.tar.gz [root@pghost5 ~]# cd libressl-3.5.1 [root@pghost5 libressl-3.5.1]# ./config [root@pghost5 libressl-3.5.1]# make [root@pghost5 libressl-3.5.1]# make install?安裝完畢,驗證:
[root@pghost5 ~]# openssl version LibreSSL 3.5.1驗證成功。
四、安裝python-3.10.4
注意首先需要校驗本機的python是不是好的,因為linux上是自帶python的,用命令是可以看到的:
[root@pghost5 ~]# ll /usr/bin/python* -al lrwxrwxrwx 1 root root 16 Apr 19 15:06 /usr/bin/python -> /usr/bin/python2 lrwxrwxrwx 1 root root 9 Sep 9 2019 /usr/bin/python2 -> python2.7 -rwxr-xr-x 1 root root 7216 Jun 21 2019 /usr/bin/python2.7 -rwxr-xr-x 1 root root 1835 Jun 21 2019 /usr/bin/python2.7-config lrwxrwxrwx 1 root root 16 Sep 9 2019 /usr/bin/python2-config -> python2.7-config?可以看到有個自帶的python,這個python理論上一定是好的,用語句驗證:
[root@pghost5 ~]# python --version Python 2.7.5 [root@pghost5 ~]# python Python 2.7.5 (default, Jun 20 2019, 20:27:34) [GCC 4.8.5 20150623 (Red Hat 4.8.5-36)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>>?出現(xiàn)>>>,那說明自帶的python是好的,這個時候才可以開始繼續(xù)其它版本的python安裝。
如果自帶的python被損毀,比如軟連接被刪了,怎么辦,這個時候就需要首先恢復自帶的python,見另一篇文章,鏈接:自帶的python軟連接被刪,如何恢復,這個必須要先恢復,不然會報很多奇葩的問題,因為自帶的,好多命令都用到了。
添加環(huán)境比變量:
export LDFLAGS="-L/usr/local/openssl/lib"
export CPPFLAGS="-I/usr/local/openssl/include"
export PKG_CONFIG_PATH="/usr/local/openssl/lib/pkgconfig"
安裝依賴包:
[root@pghost5 ~]# yum -y install bzip2 bzip2-devel ncurses openssl openssl-devel openssl-static xz lzma xz-devel sqlite sqlite-devel gdbm gdbm-devel tk tk-devel libffi-devel?安裝python-3.10.4
[root@pghost5 ~]# tar xvf Python-3.10.4.tar [root@pghost5 ~]# cd Python-3.10.4 [root@pghost5 Python-3.10.4]# ./configure --prefix=/usr/local/Python3.10 [root@pghost5 Python-3.10.4]# make [root@pghost5 Python-3.10.4]# make install?做軟連接:
[root@pghost5 ~]# ln -s /usr/local/python3.10/bin/python3 /usr/bin/python3 [root@pghost5 ~]# ln -s /usr/local/python3.10/bin/pip3 /usr/bin/pip3驗證成功與否:
[root@pghost5 ~]# python3 --version Python 3.10.4 [root@pghost5 ~]# pip3 -V pip 22.0.4 from /usr/local/python3/lib/python3.10/site-packages/pip (python 3.10)總結(jié)
以上是生活随笔為你收集整理的linux python-3.10.4 安装的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: dockfile应用(二)
- 下一篇: 垂直梯形校正画质损失多少_梯形校正功能是