易陆发现互联网技术论坛

 找回密码
 开始注册
查看: 300|回复: 0
收起左侧

centos7.9安装python3.10版本

[复制链接]
发表于 2025-8-9 10:55:48 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?开始注册

x
centos7.9安装python3.10版本
" C6 p7 Q0 J$ X先下载python3.10版本
1 @( E) q% _$ y' }8 m3 i; d# s8 J) E5 B
( W( t6 ?: E7 x1 T" mPython 3.10要求的openssl最低版本为1.1.1,环境中自带的1.0.2k无法使用,所以需要先升级openssl版本至1.1.1以上
. b9 p7 U' B- l& @wget https://www.openssl.org/source/openssl-1.1.1k.tar.gz5 P& j! R& N' L( ^7 L2 E  C
--2025-08-08 23:02:41--  https://www.openssl.org/source/openssl-1.1.1k.tar.gz
4 f% f+ D, x" \/ ?, ?Resolving www.openssl.org (www.openssl.org)... 34.49.79.89, 2600:1901:0:d50b::
! T4 v$ a& B, [# A1 c1 ^: y$ {& d8 kConnecting to www.openssl.org (www.openssl.org)|34.49.79.89|:443... connected.7 c6 y  a: {9 s
HTTP request sent, awaiting response... 301 Moved Permanently
, N  B+ q# A- B2 mLocation: https://github.com/openssl/opens ... enssl-1.1.1k.tar.gz [following]4 J6 n! N0 s0 e& p4 m* E
--2025-08-08 23:02:43--  https://github.com/openssl/opens ... enssl-1.1.1k.tar.gz
$ L% s7 T) Z2 p! l3 K$ C. r5 x) GResolving github.com (github.com)... 20.205.243.166
4 e8 I' V$ P4 k$ A7 @5 o" i, ^  oConnecting to github.com (github.com)|20.205.243.166|:443... connected.; p# ~, [( j9 j) C; M$ a5 o0 S
HTTP request sent, awaiting response... 302 Found; I% \! y$ M& ^
Location: https://release-assets.githubuse ... tion%2Foctet-stream [following]
9 L2 h" u4 Y. ^8 R* g$ v--2025-08-08 23:02:43--  https://release-assets.githubuse ... tion%2Foctet-stream
( N" Z- v7 Z0 d5 n1 ?9 gResolving release-assets.githubusercontent.com (release-assets.githubusercontent.com)... 185.199.109.133, 185.199.111.133, 185.199.108.133, ...
. @$ P& R% F* L) R& |; c  sConnecting to release-assets.githubusercontent.com (release-assets.githubusercontent.com)|185.199.109.133|:443... connected.. X$ G/ _/ t) q* f' ~
HTTP request sent, awaiting response... 200 OK
- [1 `# S$ o! i7 q3 i' s9 Y* ILength: 9823400 (9.4M) [application/octet-stream]5 O0 F5 i0 Q9 z
Saving to: ‘openssl-1.1.1k.tar.gz’; S7 w/ a2 f+ k% {; Z, p
0 h- o3 S1 g2 c1 o( Q/ M
7 s. ^$ W$ W! c8 W- }+ Z( Q: m
100%[=====================================================================================================================================================================================================>] 9,823,400    203KB/s   in 44s   4 ?% C7 R- N0 z

- y- s6 Z3 I$ E; @
9 I: J$ ], J( T4 A& i3 t7 g/ ~7 C
2025-08-08 23:03:28 (218 KB/s) - ‘openssl-1.1.1k.tar.gz’ saved [9823400/9823400]
+ }- k8 e+ B$ d5 s4 H* z9 u2 u4 {% A
2 K3 W+ f" o( b; K0 L2 _( o
备份文件:
) ^& A1 [- x" m+ H; M; c! j; Z
# o9 E9 G" A  R( ], F$ f' x- J# mv /usr/bin/openssl /usr/bin/openssl.bak* a4 \- n- O7 p; R

4 ?6 ~9 ^! q/ P

: s' d8 g+ e3 V. _! X
6 X0 c! H; m# a2 W5 E# mv /usr/include/openssl /usr/include/
. `0 t7 D/ H+ E3 MDisplay all 163 possibilities? (y or n)* x6 m; [0 y7 m5 f" a2 j1 B
# mv /usr/include/openssl /usr/include//openssl.bak6 p+ a: O$ X3 H+ ^4 s

! T7 A8 N0 m3 c. `, t  Y; m1 P

3 Y0 d  T7 h+ A7 T+ F! [+ M解压openssl. P, @( }2 k* V8 Y" \
# tar -zxvf openssl-1.1.1k.tar.gz
* U' i6 R/ c+ G# p- ~& D5 m$ B5 O9 K3 B1 `1 \( [
2 P' ^/ l- M2 X! y
# cd openssl-1.1.1k/
, z# i2 Z+ x; n8 s3 I6 V# mkdir build
) T8 w. M6 |% L/ l# cd build/6 q' l* F) Q# J1 j: u
' B; p8 P4 F) t. A. h
# ../config --prefix=/usr/local/openssl
9 y; s' Y' N8 Y( F/ eOperating system: x86_64-whatever-linux2
- E# O7 d' x( r2 `: _  s3 HConfiguring OpenSSL version 1.1.1k (0x101010bfL) for linux-x86_64
* s* _8 |& w, ?9 e5 R. zUsing os-specific seed configuration% R4 p4 d2 @  v; S2 S
Creating configdata.pm
8 ]8 j) h2 d* L+ q/ [Creating Makefile/ {, Z% N, E5 C6 f
( h2 V) \8 q5 }: I5 l$ P3 m7 h+ H
; }9 I+ R5 E( O3 `. [
**********************************************************************
* S( i( n4 p! x***                                                                ***
& z; H' c* f' V3 o***   OpenSSL has been successfully configured                     ***
/ r0 h3 r8 w: ^+ ?! I***                                                                ***
+ D9 B. {$ ~! F. I" P" l. ~***   If you encounter a problem while building, please open an    ***" G! S1 Z: g( R  c2 X
***   issue on GitHub <https://github.com/openssl/openssl/issues>  ***
+ A9 z# w$ o8 G' @+ @, M2 m***   and include the output from the following command:           ***! C+ G, o. f1 q7 R- n8 y3 n5 N' o
***                                                                **** m% p+ ~! N# Z8 D
***       perl configdata.pm --dump                                ***  }* B/ L/ x7 G7 y8 A0 J. }
***                                                                ***  D: V5 c0 R: d" F
***   (If you are new to OpenSSL, you might want to consult the    ***
3 W/ G6 u0 N) r/ Q8 d# R& b& N***   'Troubleshooting' section in the INSTALL file first)         ***  e: [1 u+ z  m6 ?2 G2 C( x  o
***                                                                ***
" t% {; Z) v8 m8 h**********************************************************************/ ^2 S: V. u( U3 m7 |3 ^
* R+ {( r( ?9 ~) I
# make -j && make install
! k5 x' [7 R  x+ P7 [! p/ j2 c
- p: F$ s7 R  O; G" a  V

. V# `( N. k5 z2 }7 k$ m0 l$ g# echo "/usr/local/openssl/lib/" >> /etc/ld.so.conf
- B- X1 X) p) d2 S# ldconfig -v  Y7 R  }% |: z' B. s8 y
ldconfig: Can't stat /libx32: No such file or directory
$ _$ n4 p- e3 Z8 [+ Nldconfig: Path `/usr/lib' given more than once- F4 W% {* h. y
ldconfig: Path `/usr/lib64' given more than once, K8 D7 S, g6 a: v# o: `' u9 v
ldconfig: Can't stat /usr/libx32: No such file or directory
  s1 X5 _5 Q" z* t( Y7 v/usr/lib64//bind9-export:3 J, k' Q. l2 V! ?7 b0 {+ w# m0 G
        libisccfg-export.so.160 -> libisccfg-export.so.160.2.1
& J$ {7 }% g' |  d& u8 a& o, t. M5 r
# openssl version
* V* |/ Q$ {0 POpenSSL 1.1.1k  25 Mar 2021, u2 `- o& b. _

& J; L' X4 x/ p6 B& V( Z) y7 q
4 i# {/ ~1 j  l- _接下来安装python3.12.10和pip35 D) H/ \0 _5 b' D" p
下载python3.12.7源代码2 o, z( @$ H, X/ A: E: A: p
# tar -zxvf Python-3.12.10.tgz- W8 c! v* G# S$ }* F6 [

8 K% j6 O' a4 F. E# yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gcc make/ Z! H* ?, Q$ H8 ^& x. u
' j9 m$ y4 o7 V/ f: ^. Z+ B7 X
4 ~8 ~6 V. x1 M; ]9 S

6 j1 q" I6 `  g" {/ O; i7 I$ c# j7 S2 ?1 [& I2 e2 Y

' B5 H$ J$ s# Z, [; U/ w进入解压后的源代码目录
: I, [/ e& Q) F/ t! O! l% T: }; h; {* V  O. l- Q5 Z
# cd /usr/src/Python-3.12.10/8 x+ ?7 ]5 j3 |' ^3 G$ H

& Q) K0 k: F/ ]$ a& H% W8 |! w( m; ?# q/ Y- [  I, X, k
% q) P  L) s. O9 B) G% q

  `! W5 h; ^; O) U配置2 {' V- |/ T. C. m9 |' d3 w$ D
# ./configure --prefix=/usr/local/python-3.12.10 --with-openssl=/usr/local/openssl% s5 r9 u' }9 k& c
1 W, _+ m' c# w1 ]7 x# O

9 C0 w% t+ C7 c+ X编译4 U1 ]9 [* U% o1 W1 [# U4 G/ r& O
make
/ I) B8 a, x6 I! q安装
# y. J# P) R. f" d+ U  m( t/ @! lmake install0 O" @: O; G$ |4 l0 Z: M
# ?) X* V) U3 x, n

. B, Y# u" e. @6 U# A3 y  f( L2 q) n0 O) O# A
# make && make install* \+ S% I( p  O
gcc -std=gnu11 -pthread -c -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O3 -Wall    -std=c11 -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wstrict-prototypes -Werror=implicit-function-declaration -fvisibility=hidden  -I./Include/internal  -I. -I./Include    -DPy_BUILD_CORE -o Programs/python.o ./Programs/python.c
) M1 R0 D, D+ k+ `& B2 f1 T0 Ugcc -std=gnu11 -pthread -c -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O3 -Wall    -std=c11 -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wstrict-prototypes -Werror=implicit-function-declaration -fvisibility=hidden  -I./Include/internal  -I. -I./Include    -DPy_BUILD_CORE -o Parser/token.o Parser/token.c
% b* R/ s& p. p' p- s# N7 k9 r7 tgcc -std=gnu11 -pthread -c -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O3 -Wall    -std=c11 -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wstrict-prototypes -Werror=implicit-function-declaration -fvisibility=hidden  -I./Include/internal  -I. -I./Include    -DPy_BUILD_CORE -o Parser/pegen.o Parser/pegen.c
  |2 n- Q; P) Wgcc -std=gnu11 -pthread -c -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O3 -Wall    -std=c11 -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wstrict-prototypes -Werror=implicit-function-declaration -fvisibility=hidden  -I./Include/internal  -I. -I./Include    -DPy_BUILD_CORE -o Parser/pegen_errors.o Parser/pegen_err
# J& J) I) L7 p& s4 F9 {6 r

; k' o9 I  t0 G
3 ]2 q1 R) h7 O) I

/ V; b7 \, T5 a  M/ T创建软链接8 ^2 h3 w& s- {! c! G" Z
ln -s /usr/src/Python-3.12.7/Python-3.12.7/bin/python3.12 /usr/bin/python3
5 h5 \# O) O1 X0 K7 F& }ln -s /usr/src/Python-3.12.7/Python-3.12.7/bin/pip3 /usr/bin/pip3
7 _/ e% {0 u4 D2 T" O/ m6 k: n4 L& m' p, N

4 N. {# u1 y4 W4 Y1 L2 F验证python3及pip3
( [, D5 L+ C5 u2 z[root@centos7 Python-3.12.7]# python3 --version
6 `/ _4 |/ W) HPython 3.12.7
( v- z- ~" N& E4 ]2 f[root@centos7 Python-3.12.7]# pip3 --version0 v/ v2 m: r# ~  E3 _$ T# e
pip 24.2 from /usr/src/Python-3.12.7/Python-3.12.7/lib/python3.12/site-packages/pip (python 3.12)
  X8 [, b7 I' Y! V& }) N
7 d4 H; K6 m, s" i0 lbash/ _8 `" R6 s; {% m
1 h2 p3 {& I$ ?4 N$ Y( T" ~* ?* j. {

/ z; S8 f$ h7 ?7 @+ f$ M6 k
您需要登录后才可以回帖 登录 | 开始注册

本版积分规则

关闭

站长推荐上一条 /4 下一条

北京云银创陇科技有限公司以云计算运维,代码开发

QQ|返回首页|Archiver|小黑屋|易陆发现技术论坛 ( 蜀ICP备2026014127号-1 )点击这里给我发消息

GMT+8, 2026-4-8 21:20 , Processed in 0.046846 second(s), 22 queries .

Powered by Discuz! X3.4 Licensed

© 2012-2025 Discuz! Team.

快速回复 返回顶部 返回列表