Centos7 安装卸载Python

1、卸载已有的python3

#卸载pyhton3
[root@kycxnode111 ~]# rpm -qa|grep python3|xargs rpm -ev --allmatches --nodeps 
软件包准备中...
python3-libs-3.6.8-13.el7.x86_64
python3-pip-9.0.3-7.el7_7.noarch
python3-setuptools-39.2.0-10.el7.noarch
python3-3.6.8-13.el7.x86_64

#删除所有残余文件
[root@kycxnode111 ~]# whereis python3 |xargs rm -frv
已删除目录:"/usr/lib/python3.6/site-packages/__pycache__"
已删除目录:"/usr/lib/python3.6/site-packages"
已删除目录:"/usr/lib/python3.6"

# 查看目前系统中的python
[root@kycxnode111 ~]# whereis python
python: /usr/bin/python /usr/bin/python2.7 /usr/bin/python2.7-config /usr/lib/python2.7 /usr/lib64/python2.7 /etc/python /usr/include/python2.7 /usr/share/man/man1/python.1.gz

2、下载安装最新的python

1)、安装依赖包

yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gcc* make -y
[root@kycxnode111 ~]# yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gcc* make -y
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
epel/x86_64/metalink                                                                 | 6.6 kB  00:00:00
 * base: mirror.bit.edu.cn
 * epel: d2lzkl7pfhq30w.cloudfront.net
 * extras: mirror.bit.edu.cn
 * updates: mirrors.aliyun.com
base                                                                                 | 3.6 kB  00:00:00
docker-ce-stable                                                                     | 3.5 kB  00:00:00
epel                                                                                 | 4.7 kB  00:00:00
extras                                                                               | 2.9 kB  00:00:00
updates                                                                              | 2.9 kB  00:00:00
(1/3): updates/7/x86_64/primary_db                                                   | 4.5 MB  00:00:12
(2/3): epel/x86_64/updateinfo     

2、下载python的安装包

wget https://www.python.org/ftp/python/3.8.4/Python-3.8.4.tgz

PS:这里下载python3.8.5 是因为要与后面系统中的Django的稳定性好

3、解压python安装包 并创建python3 的文件夹

tar -xvf Python-3.8.4.tgz
mkdir /usr/local/python3



4、配置安装路径

configure是一个shell脚本,根据平台的特性生成Makefile文件,为下一步的编译做准备。可以通过在 configure 后加上参数来对安装进行控制,比如下面就是指定安装目录/usr/local/python3。如果没有用这个选项,安装过程结束后,该软件所需的软件被复制到不同的系统目录下,比较混乱。

切入到解压目录下

cd Python-3.8.4/
./configure --prefix=/usr/local/python3
  1 [root@kycxnode111 Python-3.8.4]# ls
  2 aclocal.m4          config.sub    Doc      install-sh  m4               Misc     Parser   Programs       README.rst
  3 CODE_OF_CONDUCT.md  configure     Grammar  Lib         Mac              Modules  PC       pyconfig.h.in  setup.py
  4 config.guess        configure.ac  Include  LICENSE     Makefile.pre.in  Objects  PCbuild  Python         Tools
  5 [root@kycxnode111 Python-3.8.4]# ./configure --prefix=/usr/local/python3 --with-ssl
  6 configure: WARNING: unrecognized options: --with-ssl
  7 checking build system type... x86_64-pc-linux-gnu
  8 checking host system type... x86_64-pc-linux-gnu
  9 checking for python3.8... no
 10 checking for python3... no
 11 checking for python... python
 12 checking for --enable-universalsdk... no
 13 checking for --with-universal-archs... no
 14 checking MACHDEP... "linux"
 15 checking for gcc... gcc
 16 checking whether the C compiler works... yes
 17 checking for C compiler default output file name... a.out
 18 checking for suffix of executables...
 19 checking whether we are cross compiling... no
 20 checking for suffix of object files... o
 21 checking whether we are using the GNU C compiler... yes
 22 checking whether gcc accepts -g... yes
 23 checking for gcc option to accept ISO C89... none needed
 24 checking how to run the C preprocessor... gcc -E
 25 checking for grep that handles long lines and -e... /usr/bin/grep
 26 checking for a sed that does not truncate output... /usr/bin/sed
 27 checking for --with-cxx-main=<compiler>... no
 28 checking for g++... no
 29 configure:
 30 
 31   By default, distutils will build C++ extension modules with "g++".
 32   If this is not intended, then set CXX on the configure command line.
 33 
 34 checking for the platform triplet based on compiler characteristics... x86_64-linux-gnu
 35 checking for -Wl,--no-as-needed... yes
 36 checking for egrep... /usr/bin/grep -E
 37 checking for ANSI C header files... yes
 38 checking for sys/types.h... yes
 39 checking for sys/stat.h... yes
 40 checking for stdlib.h... yes
 41 checking for string.h... yes
 42 checking for memory.h... yes
 43 checking for strings.h... yes
 44 checking for inttypes.h... yes
 45 checking for stdint.h... yes
 46 checking for unistd.h... yes
 47 checking minix/config.h usability... no
 48 checking minix/config.h presence... no
 49 checking for minix/config.h... no
 50 checking whether it is safe to define __EXTENSIONS__... yes
 51 checking for the Android API level... not Android
 52 checking for --with-suffix...
 53 checking for case-insensitive build directory... no
 54 checking LIBRARY... libpython$(VERSION)$(ABIFLAGS).a
 55 checking LINKCC... $(PURIFY) $(MAINCC)
 56 checking for GNU ld... yes
 57 checking for --enable-shared... no
 58 checking for --enable-profiling... no
 59 checking LDLIBRARY... libpython$(VERSION)$(ABIFLAGS).a
 60 checking for ar... ar
 61 checking for readelf... readelf
 62 checking for a BSD-compatible install... /usr/bin/install -c
 63 checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
 64 checking for --with-pydebug... no
 65 checking for --with-trace-refs... no
 66 checking for --with-assertions... no
 67 checking for --enable-optimizations... no
 68 checking PROFILE_TASK... -m test --pgo
 69 checking for --with-lto... no
 70 checking for llvm-profdata... no
 71 checking for -Wextra... yes
 72 checking whether gcc accepts and needs -fno-strict-aliasing... no
 73 checking if we can turn off gcc unused result warning... yes
 74 checking if we can turn off gcc unused parameter warning... yes
 75 checking if we can turn off gcc missing field initializers warning... yes
 76 checking if we can turn on gcc mixed sign comparison warning... yes
 77 checking if we can turn on gcc unreachable code warning... no
 78 checking if we can turn on gcc strict-prototypes warning... no
 79 checking if we can make implicit function declaration an error in gcc... yes
 80 checking whether pthreads are available without options... no
 81 checking whether gcc accepts -Kpthread... no
 82 checking whether gcc accepts -Kthread... no
 83 checking whether gcc accepts -pthread... yes
 84 checking whether g++ also accepts flags for thread support... yes
 85 checking for ANSI C header files... (cached) yes
 86 checking asm/types.h usability... yes
 87 checking asm/types.h presence... yes
 88 checking for asm/types.h... yes
 89 checking crypt.h usability... yes
 90 checking crypt.h presence... yes
 91 checking for crypt.h... yes
 92 checking conio.h usability... no
 93 checking conio.h presence... no
 94 checking for conio.h... no
 95 checking direct.h usability... no
 96 checking direct.h presence... no
 97 checking for direct.h... no
 98 checking dlfcn.h usability... yes
 99 checking dlfcn.h presence... yes
100 checking for dlfcn.h... yes
101 checking errno.h usability... yes
102 checking errno.h presence... yes
103 checking for errno.h... yes
104 checking fcntl.h usability... yes
105 checking fcntl.h presence... yes
106 checking for fcntl.h... yes
107 checking grp.h usability... yes
108 checking grp.h presence... yes
109 checking for grp.h... yes
110 checking ieeefp.h usability... no
111 checking ieeefp.h presence... no
112 checking for ieeefp.h... no
113 checking io.h usability... no
114 checking io.h presence... no
115 checking for io.h... no
116 checking langinfo.h usability... yes
117 checking langinfo.h presence... yes
118 checking for langinfo.h... yes
119 checking libintl.h usability... yes
120 checking libintl.h presence... yes
121 checking for libintl.h... yes
122 checking process.h usability... no
123 checking process.h presence... no
124 checking for process.h... no
125 checking pthread.h usability... yes
126 checking pthread.h presence... yes
127 checking for pthread.h... yes
128 checking sched.h usability... yes
129 checking sched.h presence... yes
130 checking for sched.h... yes
131 checking shadow.h usability... yes
132 checking shadow.h presence... yes
133 checking for shadow.h... yes
134 checking signal.h usability... yes
135 checking signal.h presence... yes
136 checking for signal.h... yes
137 checking stropts.h usability... no
138 checking stropts.h presence... no
139 checking for stropts.h... no
140 checking termios.h usability... yes
141 checking termios.h presence... yes
142 checking for termios.h... yes
143 checking utime.h usability... yes
144 checking utime.h presence... yes
145 checking for utime.h... yes
146 checking poll.h usability... yes
147 checking poll.h presence... yes
148 checking for poll.h... yes
149 checking sys/devpoll.h usability... no
150 checking sys/devpoll.h presence... no
151 checking for sys/devpoll.h... no
152 checking sys/epoll.h usability... yes
153 checking sys/epoll.h presence... yes
154 checking for sys/epoll.h... yes
155 checking sys/poll.h usability... yes
156 checking sys/poll.h presence... yes
157 checking for sys/poll.h... yes
158 checking sys/audioio.h usability... no
159 checking sys/audioio.h presence... no
160 checking for sys/audioio.h... no
161 checking sys/xattr.h usability... yes
162 checking sys/xattr.h presence... yes
163 checking for sys/xattr.h... yes
164 checking sys/bsdtty.h usability... no
165 checking sys/bsdtty.h presence... no
166 checking for sys/bsdtty.h... no
167 checking sys/event.h usability... no
168 checking sys/event.h presence... no
169 checking for sys/event.h... no
170 checking sys/file.h usability... yes
171 checking sys/file.h presence... yes
172 checking for sys/file.h... yes
173 checking sys/ioctl.h usability... yes
174 checking sys/ioctl.h presence... yes
175 checking for sys/ioctl.h... yes
176 checking sys/kern_control.h usability... no
177 checking sys/kern_control.h presence... no
178 checking for sys/kern_control.h... no
179 checking sys/loadavg.h usability... no
180 checking sys/loadavg.h presence... no
181 checking for sys/loadavg.h... no
182 checking sys/lock.h usability... no
183 checking sys/lock.h presence... no
184 checking for sys/lock.h... no
185 checking sys/mkdev.h usability... no
186 checking sys/mkdev.h presence... no
187 checking for sys/mkdev.h... no
188 checking sys/modem.h usability... no
189 checking sys/modem.h presence... no
190 checking for sys/modem.h... no
191 checking sys/param.h usability... yes
192 checking sys/param.h presence... yes
193 checking for sys/param.h... yes
194 checking sys/random.h usability... no
195 checking sys/random.h presence... no
196 checking for sys/random.h... no
197 checking sys/select.h usability... yes
198 checking sys/select.h presence... yes
199 checking for sys/select.h... yes
200 checking sys/sendfile.h usability... yes
201 checking sys/sendfile.h presence... yes
202 checking for sys/sendfile.h... yes
203 checking sys/socket.h usability... yes
204 checking sys/socket.h presence... yes
205 checking for sys/socket.h... yes
206 checking sys/statvfs.h usability... yes
207 checking sys/statvfs.h presence... yes
208 checking for sys/statvfs.h... yes
209 checking for sys/stat.h... (cached) yes
210 checking sys/syscall.h usability... yes
211 checking sys/syscall.h presence... yes
212 checking for sys/syscall.h... yes
213 checking sys/sys_domain.h usability... no
214 checking sys/sys_domain.h presence... no
215 checking for sys/sys_domain.h... no
216 checking sys/termio.h usability... no
217 checking sys/termio.h presence... no
218 checking for sys/termio.h... no
219 checking sys/time.h usability... yes
220 checking sys/time.h presence... yes
221 checking for sys/time.h... yes
222 checking sys/times.h usability... yes
223 checking sys/times.h presence... yes
224 checking for sys/times.h... yes
225 checking for sys/types.h... (cached) yes
226 checking sys/uio.h usability... yes
227 checking sys/uio.h presence... yes
228 checking for sys/uio.h... yes
229 checking sys/un.h usability... yes
230 checking sys/un.h presence... yes
231 checking for sys/un.h... yes
232 checking sys/utsname.h usability... yes
233 checking sys/utsname.h presence... yes
234 checking for sys/utsname.h... yes
235 checking sys/wait.h usability... yes
236 checking sys/wait.h presence... yes
237 checking for sys/wait.h... yes
238 checking pty.h usability... yes
239 checking pty.h presence... yes
240 checking for pty.h... yes
241 checking libutil.h usability... no
242 checking libutil.h presence... no
243 checking for libutil.h... no
244 checking sys/resource.h usability... yes
245 checking sys/resource.h presence... yes
246 checking for sys/resource.h... yes
247 checking netpacket/packet.h usability... yes
248 checking netpacket/packet.h presence... yes
249 checking for netpacket/packet.h... yes
250 checking sysexits.h usability... yes
251 checking sysexits.h presence... yes
252 checking for sysexits.h... yes
253 checking bluetooth.h usability... no
254 checking bluetooth.h presence... no
255 checking for bluetooth.h... no
256 checking linux/tipc.h usability... yes
257 checking linux/tipc.h presence... yes
258 checking for linux/tipc.h... yes
259 checking linux/random.h usability... yes
260 checking linux/random.h presence... yes
261 checking for linux/random.h... yes
262 checking spawn.h usability... yes
263 checking spawn.h presence... yes
264 checking for spawn.h... yes
265 checking util.h usability... no
266 checking util.h presence... no
267 checking for util.h... no
268 checking alloca.h usability... yes
269 checking alloca.h presence... yes
270 checking for alloca.h... yes
271 checking endian.h usability... yes
272 checking endian.h presence... yes
273 checking for endian.h... yes
274 checking sys/endian.h usability... no
275 checking sys/endian.h presence... no
276 checking for sys/endian.h... no
277 checking sys/sysmacros.h usability... yes
278 checking sys/sysmacros.h presence... yes
279 checking for sys/sysmacros.h... yes
280 checking linux/memfd.h usability... yes
281 checking linux/memfd.h presence... yes
282 checking for linux/memfd.h... yes
283 checking sys/memfd.h usability... no
284 checking sys/memfd.h presence... no
285 checking for sys/memfd.h... no
286 checking sys/mman.h usability... yes
287 checking sys/mman.h presence... yes
288 checking for sys/mman.h... yes
289 checking for dirent.h that defines DIR... yes
290 checking for library containing opendir... none required
291 checking whether sys/types.h defines makedev... yes
292 checking bluetooth/bluetooth.h usability... no
293 checking bluetooth/bluetooth.h presence... no
294 checking for bluetooth/bluetooth.h... no
295 checking for net/if.h... yes
296 checking for linux/netlink.h... yes
297 checking for linux/qrtr.h... no
298 checking for linux/vm_sockets.h... yes
299 checking for linux/can.h... yes
300 checking for linux/can/raw.h... yes
301 checking for linux/can/bcm.h... yes
302 checking for clock_t in time.h... yes
303 checking for makedev... yes
304 checking for le64toh... yes
305 checking for mode_t... yes
306 checking for off_t... yes
307 checking for pid_t... yes
308 checking for size_t... yes
309 checking for uid_t in sys/types.h... yes
310 checking for ssize_t... yes
311 checking for __uint128_t... yes
312 checking size of int... 4
313 checking size of long... 8
314 checking size of long long... 8
315 checking size of void *... 8
316 checking size of short... 2
317 checking size of float... 4
318 checking size of double... 8
319 checking size of fpos_t... 16
320 checking size of size_t... 8
321 checking size of pid_t... 4
322 checking size of uintptr_t... 8
323 checking for long double... yes
324 checking size of long double... 16
325 checking size of _Bool... 1
326 checking size of off_t... 8
327 checking whether to enable large file support... no
328 checking size of time_t... 8
329 checking for pthread_t... yes
330 checking size of pthread_t... 8
331 checking size of pthread_key_t... 4
332 checking whether pthread_key_t is compatible with int... yes
333 checking for --enable-framework... no
334 checking for dyld... no
335 checking the extension of shared libraries... .so
336 checking LDSHARED... $(CC) -shared
337 checking CCSHARED... -fPIC
338 checking LINKFORSHARED... -Xlinker -export-dynamic
339 checking CFLAGSFORSHARED...
340 checking SHLIBS... $(LIBS)
341 checking for sendfile in -lsendfile... no
342 checking for dlopen in -ldl... yes
343 checking for shl_load in -ldld... no
344 checking uuid/uuid.h usability... yes
345 checking uuid/uuid.h presence... yes
346 checking for uuid/uuid.h... yes
347 checking uuid.h usability... no
348 checking uuid.h presence... no
349 checking for uuid.h... no
350 checking for uuid_generate_time_safe... yes
351 checking for uuid_create... no
352 checking for uuid_enc_be... no
353 checking for library containing sem_init... -lpthread
354 checking for textdomain in -lintl... no
355 checking aligned memory access is required... no
356 checking for --with-hash-algorithm... default
357 checking for --with-address-sanitizer... no
358 checking for --with-memory-sanitizer... no
359 checking for --with-undefined-behavior-sanitizer... no
360 checking for t_open in -lnsl... no
361 checking for socket in -lsocket... no
362 checking for --with-libs... no
363 checking for pkg-config... /usr/bin/pkg-config
364 checking pkg-config is at least version 0.9.0... yes
365 checking for --with-system-expat... no
366 checking for --with-system-ffi... yes
367 checking for --with-system-libmpdec... no
368 checking for --with-decimal-contextvar... yes
369 checking for --enable-loadable-sqlite-extensions... no
370 checking for --with-tcltk-includes... default
371 checking for --with-tcltk-libs... default
372 checking for --with-dbmliborder...
373 checking if PTHREAD_SCOPE_SYSTEM is supported... yes
374 checking for pthread_sigmask... yes
375 checking for pthread_getcpuclockid... yes
376 checking if --enable-ipv6 is specified... yes
377 checking if RFC2553 API is available... yes
378 checking ipv6 stack type... linux-glibc
379 checking for CAN_RAW_FD_FRAMES... yes
380 checking for --with-doc-strings... yes
381 checking for --with-pymalloc... yes
382 checking for --with-c-locale-coercion... yes
383 checking for --with-valgrind... no
384 checking for --with-dtrace... no
385 checking for dlopen... yes
386 checking DYNLOADFILE... dynload_shlib.o
387 checking MACHDEP_OBJS... none
388 checking for alarm... yes
389 checking for accept4... yes
390 checking for setitimer... yes
391 checking for getitimer... yes
392 checking for bind_textdomain_codeset... yes
393 checking for chown... yes
394 checking for clock... yes
395 checking for confstr... yes
396 checking for copy_file_range... no
397 checking for ctermid... yes
398 checking for dup3... yes
399 checking for execv... yes
400 checking for explicit_bzero... no
401 checking for explicit_memset... no
402 checking for faccessat... yes
403 checking for fchmod... yes
404 checking for fchmodat... yes
405 checking for fchown... yes
406 checking for fchownat... yes
407 checking for fdwalk... no
408 checking for fexecve... yes
409 checking for fdopendir... yes
410 checking for fork... yes
411 checking for fpathconf... yes
412 checking for fstatat... yes
413 checking for ftime... yes
414 checking for ftruncate... yes
415 checking for futimesat... yes
416 checking for futimens... yes
417 checking for futimes... yes
418 checking for gai_strerror... yes
419 checking for getentropy... no
420 checking for getgrgid_r... yes
421 checking for getgrnam_r... yes
422 checking for getgrouplist... yes
423 checking for getgroups... yes
424 checking for getlogin... yes
425 checking for getloadavg... yes
426 checking for getpeername... yes
427 checking for getpgid... yes
428 checking for getpid... yes
429 checking for getpriority... yes
430 checking for getresuid... yes
431 checking for getresgid... yes
432 checking for getpwent... yes
433 checking for getpwnam_r... yes
434 checking for getpwuid_r... yes
435 checking for getspnam... yes
436 checking for getspent... yes
437 checking for getsid... yes
438 checking for getwd... yes
439 checking for if_nameindex... yes
440 checking for initgroups... yes
441 checking for kill... yes
442 checking for killpg... yes
443 checking for lchown... yes
444 checking for lockf... yes
445 checking for linkat... yes
446 checking for lstat... yes
447 checking for lutimes... yes
448 checking for mmap... yes
449 checking for memrchr... yes
450 checking for mbrtowc... yes
451 checking for mkdirat... yes
452 checking for mkfifo... yes
453 checking for madvise... yes
454 checking for mkfifoat... yes
455 checking for mknod... yes
456 checking for mknodat... yes
457 checking for mktime... yes
458 checking for mremap... yes
459 checking for nice... yes
460 checking for openat... yes
461 checking for pathconf... yes
462 checking for pause... yes
463 checking for pipe2... yes
464 checking for plock... no
465 checking for poll... yes
466 checking for posix_fallocate... yes
467 checking for posix_fadvise... yes
468 checking for posix_spawn... yes
469 checking for posix_spawnp... yes
470 checking for pread... yes
471 checking for preadv... yes
472 checking for preadv2... no
473 checking for pthread_condattr_setclock... yes
474 checking for pthread_init... no
475 checking for pthread_kill... yes
476 checking for putenv... yes
477 checking for pwrite... yes
478 checking for pwritev... yes
479 checking for pwritev2... no
480 checking for readlink... yes
481 checking for readlinkat... yes
482 checking for readv... yes
483 checking for realpath... yes
484 checking for renameat... yes
485 checking for sem_open... yes
486 checking for sem_timedwait... yes
487 checking for sem_getvalue... yes
488 checking for sem_unlink... yes
489 checking for sendfile... yes
490 checking for setegid... yes
491 checking for seteuid... yes
492 checking for setgid... yes
493 checking for sethostname... yes
494 checking for setlocale... yes
495 checking for setregid... yes
496 checking for setreuid... yes
497 checking for setresuid... yes
498 checking for setresgid... yes
499 checking for setsid... yes
500 checking for setpgid... yes
501 checking for setpgrp... yes
502 checking for setpriority... yes
503 checking for setuid... yes
504 checking for setvbuf... yes
505 checking for sched_get_priority_max... yes
506 checking for sched_setaffinity... yes
507 checking for sched_setscheduler... yes
508 checking for sched_setparam... yes
509 checking for sched_rr_get_interval... yes
510 checking for sigaction... yes
511 checking for sigaltstack... yes
512 checking for sigfillset... yes
513 checking for siginterrupt... yes
514 checking for sigpending... yes
515 checking for sigrelse... yes
516 checking for sigtimedwait... yes
517 checking for sigwait... yes
518 checking for sigwaitinfo... yes
519 checking for snprintf... yes
520 checking for strftime... yes
521 checking for strlcpy... no
522 checking for strsignal... yes
523 checking for symlinkat... yes
524 checking for sync... yes
525 checking for sysconf... yes
526 checking for tcgetpgrp... yes
527 checking for tcsetpgrp... yes
528 checking for tempnam... yes
529 checking for timegm... yes
530 checking for times... yes
531 checking for tmpfile... yes
532 checking for tmpnam... yes
533 checking for tmpnam_r... yes
534 checking for truncate... yes
535 checking for uname... yes
536 checking for unlinkat... yes
537 checking for unsetenv... yes
538 checking for utimensat... yes
539 checking for utimes... yes
540 checking for waitid... yes
541 checking for waitpid... yes
542 checking for wait3... yes
543 checking for wait4... yes
544 checking for wcscoll... yes
545 checking for wcsftime... yes
546 checking for wcsxfrm... yes
547 checking for wmemcmp... yes
548 checking for writev... yes
549 checking for _getpty... no
550 checking for rtpSpawn... no
551 checking whether dirfd is declared... yes
552 checking for chroot... yes
553 checking for link... yes
554 checking for symlink... yes
555 checking for fchdir... yes
556 checking for fsync... yes
557 checking for fdatasync... yes
558 checking for epoll... yes
559 checking for epoll_create1... yes
560 checking for kqueue... no
561 checking for prlimit... yes
562 checking for memfd_create... no
563 checking for ctermid_r... no
564 checking for flock declaration... yes
565 checking for flock... yes
566 checking for getpagesize... yes
567 checking for broken unsetenv... no
568 checking for true... true
569 checking for inet_aton in -lc... yes
570 checking for chflags... no
571 checking for lchflags... no
572 checking for inflateCopy in -lz... yes
573 checking for hstrerror... yes
574 checking for inet_aton... yes
575 checking for inet_pton... yes
576 checking for setgroups... yes
577 checking for openpty... no
578 checking for openpty in -lutil... yes
579 checking for forkpty... yes
580 checking for fseek64... no
581 checking for fseeko... yes
582 checking for fstatvfs... yes
583 checking for ftell64... no
584 checking for ftello... yes
585 checking for statvfs... yes
586 checking for dup2... yes
587 checking for strdup... yes
588 checking for getpgrp... yes
589 checking for setpgrp... (cached) yes
590 checking for gettimeofday... yes
591 checking for library containing crypt... -lcrypt
592 checking for library containing crypt_r... none required
593 checking for crypt_r... yes
594 checking for clock_gettime... yes
595 checking for clock_getres... yes
596 checking for clock_settime... yes
597 checking for major... yes
598 checking for getaddrinfo... yes
599 checking getaddrinfo bug... no
600 checking for getnameinfo... yes
601 checking whether time.h and sys/time.h may both be included... yes
602 checking whether struct tm is in sys/time.h or time.h... time.h
603 checking for struct tm.tm_zone... yes
604 checking for struct stat.st_rdev... yes
605 checking for struct stat.st_blksize... yes
606 checking for struct stat.st_flags... no
607 checking for struct stat.st_gen... no
608 checking for struct stat.st_birthtime... no
609 checking for struct stat.st_blocks... yes
610 checking for struct passwd.pw_gecos... yes
611 checking for struct passwd.pw_passwd... yes
612 checking for siginfo_t.si_band... yes
613 checking for time.h that defines altzone... no
614 checking whether sys/select.h and sys/time.h may both be included... yes
615 checking for addrinfo... yes
616 checking for sockaddr_storage... yes
617 checking for sockaddr_alg... yes
618 checking whether char is unsigned... no
619 checking for an ANSI C-conforming const... yes
620 checking for working signed char... yes
621 checking for prototypes... yes
622 checking for variable length prototypes and stdarg.h... yes
623 checking for socketpair... yes
624 checking if sockaddr has sa_len member... no
625 checking for gethostbyname_r... yes
626 checking gethostbyname_r with 6 args... yes
627 checking for __fpu_control... yes
628 checking for --with-libm=STRING... default LIBM="-lm"
629 checking for --with-libc=STRING... default LIBC=""
630 checking for x64 gcc inline assembler... yes
631 checking whether float word ordering is bigendian... no
632 checking whether we can use gcc inline assembler to get and set x87 control word... yes
633 checking whether we can use gcc inline assembler to get and set mc68881 fpcr... no
634 checking for x87-style double rounding... no
635 checking for acosh... yes
636 checking for asinh... yes
637 checking for atanh... yes
638 checking for copysign... yes
639 checking for erf... yes
640 checking for erfc... yes
641 checking for expm1... yes
642 checking for finite... yes
643 checking for gamma... yes
644 checking for hypot... yes
645 checking for lgamma... yes
646 checking for log1p... yes
647 checking for log2... yes
648 checking for round... yes
649 checking for tgamma... yes
650 checking whether isinf is declared... yes
651 checking whether isnan is declared... yes
652 checking whether isfinite is declared... yes
653 checking whether POSIX semaphores are enabled... yes
654 checking for broken sem_getvalue... no
655 checking whether RTLD_LAZY is declared... yes
656 checking whether RTLD_NOW is declared... yes
657 checking whether RTLD_GLOBAL is declared... yes
658 checking whether RTLD_LOCAL is declared... yes
659 checking whether RTLD_NODELETE is declared... yes
660 checking whether RTLD_NOLOAD is declared... yes
661 checking whether RTLD_DEEPBIND is declared... yes
662 checking whether RTLD_MEMBER is declared... no
663 checking digit size for Python's longs... no value specified
664 checking wchar.h usability... yes
665 checking wchar.h presence... yes
666 checking for wchar.h... yes
667 checking size of wchar_t... 4
668 checking for UCS-4 tcl... no
669 checking whether wchar_t is signed... yes
670 checking whether wchar_t is usable... no
671 checking whether byte ordering is bigendian... no
672 checking ABIFLAGS...
673 checking SOABI... cpython-38-x86_64-linux-gnu
674 checking LDVERSION... $(VERSION)$(ABIFLAGS)
675 checking whether right shift extends the sign bit... yes
676 checking for getc_unlocked() and friends... yes
677 checking how to link readline libs... -lreadline
678 checking for rl_pre_input_hook in -lreadline... yes
679 checking for rl_completion_display_matches_hook in -lreadline... yes
680 checking for rl_resize_terminal in -lreadline... yes
681 checking for rl_completion_matches in -lreadline... yes
682 checking for append_history in -lreadline... yes
683 checking for broken nice()... no
684 checking for broken poll()... no
685 checking for working tzset()... yes
686 checking for tv_nsec in struct stat... yes
687 checking for tv_nsec2 in struct stat... no
688 checking curses.h usability... yes
689 checking curses.h presence... yes
690 checking for curses.h... yes
691 checking ncurses.h usability... yes
692 checking ncurses.h presence... yes
693 checking for ncurses.h... yes
694 checking for term.h... yes
695 checking whether mvwdelch is an expression... yes
696 checking whether WINDOW has _flags... yes
697 checking for is_pad... yes
698 checking for is_term_resized... yes
699 checking for resize_term... yes
700 checking for resizeterm... yes
701 checking for immedok... yes
702 checking for syncok... yes
703 checking for wchgat... yes
704 checking for filter... yes
705 checking for has_key... yes
706 checking for typeahead... yes
707 checking for use_env... yes
708 configure: checking for device files
709 checking for /dev/ptmx... yes
710 checking for /dev/ptc... no
711 checking for %zd printf() format support... yes
712 checking for socklen_t... yes
713 checking for broken mbstowcs... no
714 checking for --with-computed-gotos... no value specified
715 checking whether gcc -pthread supports computed gotos... yes
716 checking for build directories... done
717 checking for -O2... yes
718 checking for glibc _FORTIFY_SOURCE/memmove bug... no
719 checking for gcc ipa-pure-const bug... no
720 checking for stdatomic.h... no
721 checking for GCC >= 4.7 __atomic builtins... yes
722 checking for ensurepip... upgrade
723 checking if the dirent structure of a d_type field... yes
724 checking for the Linux getrandom() syscall... yes
725 checking for the getrandom() function... no
726 checking for library containing shm_open... -lrt
727 checking for sys/mman.h... (cached) yes
728 checking for shm_open... yes
729 checking for shm_unlink... yes
730 checking for pkg-config... /usr/bin/pkg-config
731 checking whether compiling and linking against OpenSSL works... yes
732 checking for X509_VERIFY_PARAM_set1_host in libssl... yes
733 checking for --with-ssl-default-suites... python
734 configure: creating ./config.status
735 config.status: creating Makefile.pre
736 config.status: creating Misc/python.pc
737 config.status: creating Misc/python-embed.pc
738 config.status: creating Misc/python-config.sh
739 config.status: creating Modules/ld_so_aix
740 config.status: creating pyconfig.h
741 configure: WARNING: unrecognized options: --with-ssl
742 creating Modules/Setup.local
743 creating Makefile
744 
745 
746 If you want a release build with all stable optimizations active (PGO, etc),
747 please run ./configure --enable-optimizations

"--enable-optimizations"这个参数会启用配置文件引导的优化(PGO)和链接时间优化(LTO)。两者都是昂贵的优化,会减慢构建过程,但会显着提高速度(我记得阅读的内容大约有10-20%)。

./configure --enable-optimizations --prefix=/usr/local/python3
  1 [root@kycxnode111 Python-3.8.4]# ./configure --enable-optimizations --prefix=/usr/local/python3
  2 checking build system type... x86_64-pc-linux-gnu
  3 checking host system type... x86_64-pc-linux-gnu
  4 checking for python3.8... no
  5 checking for python3... no
  6 checking for python... python
  7 checking for --enable-universalsdk... no
  8 checking for --with-universal-archs... no
  9 checking MACHDEP... "linux"
 10 checking for gcc... gcc
 11 checking whether the C compiler works... yes
 12 checking for C compiler default output file name... a.out
 13 checking for suffix of executables...
 14 checking whether we are cross compiling... no
 15 checking for suffix of object files... o
 16 checking whether we are using the GNU C compiler... yes
 17 checking whether gcc accepts -g... yes
 18 checking for gcc option to accept ISO C89... none needed
 19 checking how to run the C preprocessor... gcc -E
 20 checking for grep that handles long lines and -e... /usr/bin/grep
 21 checking for a sed that does not truncate output... /usr/bin/sed
 22 checking for --with-cxx-main=<compiler>... no
 23 checking for g++... no
 24 configure:
 25 
 26   By default, distutils will build C++ extension modules with "g++".
 27   If this is not intended, then set CXX on the configure command line.
 28 
 29 checking for the platform triplet based on compiler characteristics... x86_64-linux-gnu
 30 checking for -Wl,--no-as-needed... yes
 31 checking for egrep... /usr/bin/grep -E
 32 checking for ANSI C header files... yes
 33 checking for sys/types.h... yes
 34 checking for sys/stat.h... yes
 35 checking for stdlib.h... yes
 36 checking for string.h... yes
 37 checking for memory.h... yes
 38 checking for strings.h... yes
 39 checking for inttypes.h... yes
 40 checking for stdint.h... yes
 41 checking for unistd.h... yes
 42 checking minix/config.h usability... no
 43 checking minix/config.h presence... no
 44 checking for minix/config.h... no
 45 checking whether it is safe to define __EXTENSIONS__... yes
 46 checking for the Android API level... not Android
 47 checking for --with-suffix...
 48 checking for case-insensitive build directory... no
 49 checking LIBRARY... libpython$(VERSION)$(ABIFLAGS).a
 50 checking LINKCC... $(PURIFY) $(MAINCC)
 51 checking for GNU ld... yes
 52 checking for --enable-shared... no
 53 checking for --enable-profiling... no
 54 checking LDLIBRARY... libpython$(VERSION)$(ABIFLAGS).a
 55 checking for ar... ar
 56 checking for readelf... readelf
 57 checking for a BSD-compatible install... /usr/bin/install -c
 58 checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
 59 checking for --with-pydebug... no
 60 checking for --with-trace-refs... no
 61 checking for --with-assertions... no
 62 checking for --enable-optimizations... yes
 63 checking PROFILE_TASK... -m test --pgo
 64 checking for --with-lto... no
 65 checking for llvm-profdata... no
 66 checking for -Wextra... yes
 67 checking whether gcc accepts and needs -fno-strict-aliasing... no
 68 checking if we can turn off gcc unused result warning... yes
 69 checking if we can turn off gcc unused parameter warning... yes
 70 checking if we can turn off gcc missing field initializers warning... yes
 71 checking if we can turn on gcc mixed sign comparison warning... yes
 72 checking if we can turn on gcc unreachable code warning... no
 73 checking if we can turn on gcc strict-prototypes warning... no
 74 checking if we can make implicit function declaration an error in gcc... yes
 75 checking whether pthreads are available without options... no
 76 checking whether gcc accepts -Kpthread... no
 77 checking whether gcc accepts -Kthread... no
 78 checking whether gcc accepts -pthread... yes
 79 checking whether g++ also accepts flags for thread support... yes
 80 checking for ANSI C header files... (cached) yes
 81 checking asm/types.h usability... yes
 82 checking asm/types.h presence... yes
 83 checking for asm/types.h... yes
 84 checking crypt.h usability... yes
 85 checking crypt.h presence... yes
 86 checking for crypt.h... yes
 87 checking conio.h usability... no
 88 checking conio.h presence... no
 89 checking for conio.h... no
 90 checking direct.h usability... no
 91 checking direct.h presence... no
 92 checking for direct.h... no
 93 checking dlfcn.h usability... yes
 94 checking dlfcn.h presence... yes
 95 checking for dlfcn.h... yes
 96 checking errno.h usability... yes
 97 checking errno.h presence... yes
 98 checking for errno.h... yes
 99 checking fcntl.h usability... yes
100 checking fcntl.h presence... yes
101 checking for fcntl.h... yes
102 checking grp.h usability... yes
103 checking grp.h presence... yes
104 checking for grp.h... yes
105 checking ieeefp.h usability... no
106 checking ieeefp.h presence... no
107 checking for ieeefp.h... no
108 checking io.h usability... no
109 checking io.h presence... no
110 checking for io.h... no
111 checking langinfo.h usability... yes
112 checking langinfo.h presence... yes
113 checking for langinfo.h... yes
114 checking libintl.h usability... yes
115 checking libintl.h presence... yes
116 checking for libintl.h... yes
117 checking process.h usability... no
118 checking process.h presence... no
119 checking for process.h... no
120 checking pthread.h usability... yes
121 checking pthread.h presence... yes
122 checking for pthread.h... yes
123 checking sched.h usability... yes
124 checking sched.h presence... yes
125 checking for sched.h... yes
126 checking shadow.h usability... yes
127 checking shadow.h presence... yes
128 checking for shadow.h... yes
129 checking signal.h usability... yes
130 checking signal.h presence... yes
131 checking for signal.h... yes
132 checking stropts.h usability... no
133 checking stropts.h presence... no
134 checking for stropts.h... no
135 checking termios.h usability... yes
136 checking termios.h presence... yes
137 checking for termios.h... yes
138 checking utime.h usability... yes
139 checking utime.h presence... yes
140 checking for utime.h... yes
141 checking poll.h usability... yes
142 checking poll.h presence... yes
143 checking for poll.h... yes
144 checking sys/devpoll.h usability... no
145 checking sys/devpoll.h presence... no
146 checking for sys/devpoll.h... no
147 checking sys/epoll.h usability... yes
148 checking sys/epoll.h presence... yes
149 checking for sys/epoll.h... yes
150 checking sys/poll.h usability... yes
151 checking sys/poll.h presence... yes
152 checking for sys/poll.h... yes
153 checking sys/audioio.h usability... no
154 checking sys/audioio.h presence... no
155 checking for sys/audioio.h... no
156 checking sys/xattr.h usability... yes
157 checking sys/xattr.h presence... yes
158 checking for sys/xattr.h... yes
159 checking sys/bsdtty.h usability... no
160 checking sys/bsdtty.h presence... no
161 checking for sys/bsdtty.h... no
162 checking sys/event.h usability... no
163 checking sys/event.h presence... no
164 checking for sys/event.h... no
165 checking sys/file.h usability... yes
166 checking sys/file.h presence... yes
167 checking for sys/file.h... yes
168 checking sys/ioctl.h usability... yes
169 checking sys/ioctl.h presence... yes
170 checking for sys/ioctl.h... yes
171 checking sys/kern_control.h usability... no
172 checking sys/kern_control.h presence... no
173 checking for sys/kern_control.h... no
174 checking sys/loadavg.h usability... no
175 checking sys/loadavg.h presence... no
176 checking for sys/loadavg.h... no
177 checking sys/lock.h usability... no
178 checking sys/lock.h presence... no
179 checking for sys/lock.h... no
180 checking sys/mkdev.h usability... no
181 checking sys/mkdev.h presence... no
182 checking for sys/mkdev.h... no
183 checking sys/modem.h usability... no
184 checking sys/modem.h presence... no
185 checking for sys/modem.h... no
186 checking sys/param.h usability... yes
187 checking sys/param.h presence... yes
188 checking for sys/param.h... yes
189 checking sys/random.h usability... no
190 checking sys/random.h presence... no
191 checking for sys/random.h... no
192 checking sys/select.h usability... yes
193 checking sys/select.h presence... yes
194 checking for sys/select.h... yes
195 checking sys/sendfile.h usability... yes
196 checking sys/sendfile.h presence... yes
197 checking for sys/sendfile.h... yes
198 checking sys/socket.h usability... yes
199 checking sys/socket.h presence... yes
200 checking for sys/socket.h... yes
201 checking sys/statvfs.h usability... yes
202 checking sys/statvfs.h presence... yes
203 checking for sys/statvfs.h... yes
204 checking for sys/stat.h... (cached) yes
205 checking sys/syscall.h usability... yes
206 checking sys/syscall.h presence... yes
207 checking for sys/syscall.h... yes
208 checking sys/sys_domain.h usability... no
209 checking sys/sys_domain.h presence... no
210 checking for sys/sys_domain.h... no
211 checking sys/termio.h usability... no
212 checking sys/termio.h presence... no
213 checking for sys/termio.h... no
214 checking sys/time.h usability... yes
215 checking sys/time.h presence... yes
216 checking for sys/time.h... yes
217 checking sys/times.h usability... yes
218 checking sys/times.h presence... yes
219 checking for sys/times.h... yes
220 checking for sys/types.h... (cached) yes
221 checking sys/uio.h usability... yes
222 checking sys/uio.h presence... yes
223 checking for sys/uio.h... yes
224 checking sys/un.h usability... yes
225 checking sys/un.h presence... yes
226 checking for sys/un.h... yes
227 checking sys/utsname.h usability... yes
228 checking sys/utsname.h presence... yes
229 checking for sys/utsname.h... yes
230 checking sys/wait.h usability... yes
231 checking sys/wait.h presence... yes
232 checking for sys/wait.h... yes
233 checking pty.h usability... yes
234 checking pty.h presence... yes
235 checking for pty.h... yes
236 checking libutil.h usability... no
237 checking libutil.h presence... no
238 checking for libutil.h... no
239 checking sys/resource.h usability... yes
240 checking sys/resource.h presence... yes
241 checking for sys/resource.h... yes
242 checking netpacket/packet.h usability... yes
243 checking netpacket/packet.h presence... yes
244 checking for netpacket/packet.h... yes
245 checking sysexits.h usability... yes
246 checking sysexits.h presence... yes
247 checking for sysexits.h... yes
248 checking bluetooth.h usability... no
249 checking bluetooth.h presence... no
250 checking for bluetooth.h... no
251 checking linux/tipc.h usability... yes
252 checking linux/tipc.h presence... yes
253 checking for linux/tipc.h... yes
254 checking linux/random.h usability... yes
255 checking linux/random.h presence... yes
256 checking for linux/random.h... yes
257 checking spawn.h usability... yes
258 checking spawn.h presence... yes
259 checking for spawn.h... yes
260 checking util.h usability... no
261 checking util.h presence... no
262 checking for util.h... no
263 checking alloca.h usability... yes
264 checking alloca.h presence... yes
265 checking for alloca.h... yes
266 checking endian.h usability... yes
267 checking endian.h presence... yes
268 checking for endian.h... yes
269 checking sys/endian.h usability... no
270 checking sys/endian.h presence... no
271 checking for sys/endian.h... no
272 checking sys/sysmacros.h usability... yes
273 checking sys/sysmacros.h presence... yes
274 checking for sys/sysmacros.h... yes
275 checking linux/memfd.h usability... yes
276 checking linux/memfd.h presence... yes
277 checking for linux/memfd.h... yes
278 checking sys/memfd.h usability... no
279 checking sys/memfd.h presence... no
280 checking for sys/memfd.h... no
281 checking sys/mman.h usability... yes
282 checking sys/mman.h presence... yes
283 checking for sys/mman.h... yes
284 checking for dirent.h that defines DIR... yes
285 checking for library containing opendir... none required
286 checking whether sys/types.h defines makedev... yes
287 checking bluetooth/bluetooth.h usability... no
288 checking bluetooth/bluetooth.h presence... no
289 checking for bluetooth/bluetooth.h... no
290 checking for net/if.h... yes
291 checking for linux/netlink.h... yes
292 checking for linux/qrtr.h... no
293 checking for linux/vm_sockets.h... yes
294 checking for linux/can.h... yes
295 checking for linux/can/raw.h... yes
296 checking for linux/can/bcm.h... yes
297 checking for clock_t in time.h... yes
298 checking for makedev... yes
299 checking for le64toh... yes
300 checking for mode_t... yes
301 checking for off_t... yes
302 checking for pid_t... yes
303 checking for size_t... yes
304 checking for uid_t in sys/types.h... yes
305 checking for ssize_t... yes
306 checking for __uint128_t... yes
307 checking size of int... 4
308 checking size of long... 8
309 checking size of long long... 8
310 checking size of void *... 8
311 checking size of short... 2
312 checking size of float... 4
313 checking size of double... 8
314 checking size of fpos_t... 16
315 checking size of size_t... 8
316 checking size of pid_t... 4
317 checking size of uintptr_t... 8
318 checking for long double... yes
319 checking size of long double... 16
320 checking size of _Bool... 1
321 checking size of off_t... 8
322 checking whether to enable large file support... no
323 checking size of time_t... 8
324 checking for pthread_t... yes
325 checking size of pthread_t... 8
326 checking size of pthread_key_t... 4
327 checking whether pthread_key_t is compatible with int... yes
328 checking for --enable-framework... no
329 checking for dyld... no
330 checking the extension of shared libraries... .so
331 checking LDSHARED... $(CC) -shared
332 checking CCSHARED... -fPIC
333 checking LINKFORSHARED... -Xlinker -export-dynamic
334 checking CFLAGSFORSHARED...
335 checking SHLIBS... $(LIBS)
336 checking for sendfile in -lsendfile... no
337 checking for dlopen in -ldl... yes
338 checking for shl_load in -ldld... no
339 checking uuid/uuid.h usability... yes
340 checking uuid/uuid.h presence... yes
341 checking for uuid/uuid.h... yes
342 checking uuid.h usability... no
343 checking uuid.h presence... no
344 checking for uuid.h... no
345 checking for uuid_generate_time_safe... yes
346 checking for uuid_create... no
347 checking for uuid_enc_be... no
348 checking for library containing sem_init... -lpthread
349 checking for textdomain in -lintl... no
350 checking aligned memory access is required... no
351 checking for --with-hash-algorithm... default
352 checking for --with-address-sanitizer... no
353 checking for --with-memory-sanitizer... no
354 checking for --with-undefined-behavior-sanitizer... no
355 checking for t_open in -lnsl... no
356 checking for socket in -lsocket... no
357 checking for --with-libs... no
358 checking for pkg-config... /usr/bin/pkg-config
359 checking pkg-config is at least version 0.9.0... yes
360 checking for --with-system-expat... no
361 checking for --with-system-ffi... yes
362 checking for --with-system-libmpdec... no
363 checking for --with-decimal-contextvar... yes
364 checking for --enable-loadable-sqlite-extensions... no
365 checking for --with-tcltk-includes... default
366 checking for --with-tcltk-libs... default
367 checking for --with-dbmliborder...
368 checking if PTHREAD_SCOPE_SYSTEM is supported... yes
369 checking for pthread_sigmask... yes
370 checking for pthread_getcpuclockid... yes
371 checking if --enable-ipv6 is specified... yes
372 checking if RFC2553 API is available... yes
373 checking ipv6 stack type... linux-glibc
374 checking for CAN_RAW_FD_FRAMES... yes
375 checking for --with-doc-strings... yes
376 checking for --with-pymalloc... yes
377 checking for --with-c-locale-coercion... yes
378 checking for --with-valgrind... no
379 checking for --with-dtrace... no
380 checking for dlopen... yes
381 checking DYNLOADFILE... dynload_shlib.o
382 checking MACHDEP_OBJS... none
383 checking for alarm... yes
384 checking for accept4... yes
385 checking for setitimer... yes
386 checking for getitimer... yes
387 checking for bind_textdomain_codeset... yes
388 checking for chown... yes
389 checking for clock... yes
390 checking for confstr... yes
391 checking for copy_file_range... no
392 checking for ctermid... yes
393 checking for dup3... yes
394 checking for execv... yes
395 checking for explicit_bzero... no
396 checking for explicit_memset... no
397 checking for faccessat... yes
398 checking for fchmod... yes
399 checking for fchmodat... yes
400 checking for fchown... yes
401 checking for fchownat... yes
402 checking for fdwalk... no
403 checking for fexecve... yes
404 checking for fdopendir... yes
405 checking for fork... yes
406 checking for fpathconf... yes
407 checking for fstatat... yes
408 checking for ftime... yes
409 checking for ftruncate... yes
410 checking for futimesat... yes
411 checking for futimens... yes
412 checking for futimes... yes
413 checking for gai_strerror... yes
414 checking for getentropy... no
415 checking for getgrgid_r... yes
416 checking for getgrnam_r... yes
417 checking for getgrouplist... yes
418 checking for getgroups... yes
419 checking for getlogin... yes
420 checking for getloadavg... yes
421 checking for getpeername... yes
422 checking for getpgid... yes
423 checking for getpid... yes
424 checking for getpriority... yes
425 checking for getresuid... yes
426 checking for getresgid... yes
427 checking for getpwent... yes
428 checking for getpwnam_r... yes
429 checking for getpwuid_r... yes
430 checking for getspnam... yes
431 checking for getspent... yes
432 checking for getsid... yes
433 checking for getwd... yes
434 checking for if_nameindex... yes
435 checking for initgroups... yes
436 checking for kill... yes
437 checking for killpg... yes
438 checking for lchown... yes
439 checking for lockf... yes
440 checking for linkat... yes
441 checking for lstat... yes
442 checking for lutimes... yes
443 checking for mmap... yes
444 checking for memrchr... yes
445 checking for mbrtowc... yes
446 checking for mkdirat... yes
447 checking for mkfifo... yes
448 checking for madvise... yes
449 checking for mkfifoat... yes
450 checking for mknod... yes
451 checking for mknodat... yes
452 checking for mktime... yes
453 checking for mremap... yes
454 checking for nice... yes
455 checking for openat... yes
456 checking for pathconf... yes
457 checking for pause... yes
458 checking for pipe2... yes
459 checking for plock... no
460 checking for poll... yes
461 checking for posix_fallocate... yes
462 checking for posix_fadvise... yes
463 checking for posix_spawn... yes
464 checking for posix_spawnp... yes
465 checking for pread... yes
466 checking for preadv... yes
467 checking for preadv2... no
468 checking for pthread_condattr_setclock... yes
469 checking for pthread_init... no
470 checking for pthread_kill... yes
471 checking for putenv... yes
472 checking for pwrite... yes
473 checking for pwritev... yes
474 checking for pwritev2... no
475 checking for readlink... yes
476 checking for readlinkat... yes
477 checking for readv... yes
478 checking for realpath... yes
479 checking for renameat... yes
480 checking for sem_open... yes
481 checking for sem_timedwait... yes
482 checking for sem_getvalue... yes
483 checking for sem_unlink... yes
484 checking for sendfile... yes
485 checking for setegid... yes
486 checking for seteuid... yes
487 checking for setgid... yes
488 checking for sethostname... yes
489 checking for setlocale... yes
490 checking for setregid... yes
491 checking for setreuid... yes
492 checking for setresuid... yes
493 checking for setresgid... yes
494 checking for setsid... yes
495 checking for setpgid... yes
496 checking for setpgrp... yes
497 checking for setpriority... yes
498 checking for setuid... yes
499 checking for setvbuf... yes
500 checking for sched_get_priority_max... yes
501 checking for sched_setaffinity... yes
502 checking for sched_setscheduler... yes
503 checking for sched_setparam... yes
504 checking for sched_rr_get_interval... yes
505 checking for sigaction... yes
506 checking for sigaltstack... yes
507 checking for sigfillset... yes
508 checking for siginterrupt... yes
509 checking for sigpending... yes
510 checking for sigrelse... yes
511 checking for sigtimedwait... yes
512 checking for sigwait... yes
513 checking for sigwaitinfo... yes
514 checking for snprintf... yes
515 checking for strftime... yes
516 checking for strlcpy... no
517 checking for strsignal... yes
518 checking for symlinkat... yes
519 checking for sync... yes
520 checking for sysconf... yes
521 checking for tcgetpgrp... yes
522 checking for tcsetpgrp... yes
523 checking for tempnam... yes
524 checking for timegm... yes
525 checking for times... yes
526 checking for tmpfile... yes
527 checking for tmpnam... yes
528 checking for tmpnam_r... yes
529 checking for truncate... yes
530 checking for uname... yes
531 checking for unlinkat... yes
532 checking for unsetenv... yes
533 checking for utimensat... yes
534 checking for utimes... yes
535 checking for waitid... yes
536 checking for waitpid... yes
537 checking for wait3... yes
538 checking for wait4... yes
539 checking for wcscoll... yes
540 checking for wcsftime... yes
541 checking for wcsxfrm... yes
542 checking for wmemcmp... yes
543 checking for writev... yes
544 checking for _getpty... no
545 checking for rtpSpawn... no
546 checking whether dirfd is declared... yes
547 checking for chroot... yes
548 checking for link... yes
549 checking for symlink... yes
550 checking for fchdir... yes
551 checking for fsync... yes
552 checking for fdatasync... yes
553 checking for epoll... yes
554 checking for epoll_create1... yes
555 checking for kqueue... no
556 checking for prlimit... yes
557 checking for memfd_create... no
558 checking for ctermid_r... no
559 checking for flock declaration... yes
560 checking for flock... yes
561 checking for getpagesize... yes
562 checking for broken unsetenv... no
563 checking for true... true
564 checking for inet_aton in -lc... yes
565 checking for chflags... no
566 checking for lchflags... no
567 checking for inflateCopy in -lz... yes
568 checking for hstrerror... yes
569 checking for inet_aton... yes
570 checking for inet_pton... yes
571 checking for setgroups... yes
572 checking for openpty... no
573 checking for openpty in -lutil... yes
574 checking for forkpty... yes
575 checking for fseek64... no
576 checking for fseeko... yes
577 checking for fstatvfs... yes
578 checking for ftell64... no
579 checking for ftello... yes
580 checking for statvfs... yes
581 checking for dup2... yes
582 checking for strdup... yes
583 checking for getpgrp... yes
584 checking for setpgrp... (cached) yes
585 checking for gettimeofday... yes
586 checking for library containing crypt... -lcrypt
587 checking for library containing crypt_r... none required
588 checking for crypt_r... yes
589 checking for clock_gettime... yes
590 checking for clock_getres... yes
591 checking for clock_settime... yes
592 checking for major... yes
593 checking for getaddrinfo... yes
594 checking getaddrinfo bug... no
595 checking for getnameinfo... yes
596 checking whether time.h and sys/time.h may both be included... yes
597 checking whether struct tm is in sys/time.h or time.h... time.h
598 checking for struct tm.tm_zone... yes
599 checking for struct stat.st_rdev... yes
600 checking for struct stat.st_blksize... yes
601 checking for struct stat.st_flags... no
602 checking for struct stat.st_gen... no
603 checking for struct stat.st_birthtime... no
604 checking for struct stat.st_blocks... yes
605 checking for struct passwd.pw_gecos... yes
606 checking for struct passwd.pw_passwd... yes
607 checking for siginfo_t.si_band... yes
608 checking for time.h that defines altzone... no
609 checking whether sys/select.h and sys/time.h may both be included... yes
610 checking for addrinfo... yes
611 checking for sockaddr_storage... yes
612 checking for sockaddr_alg... yes
613 checking whether char is unsigned... no
614 checking for an ANSI C-conforming const... yes
615 checking for working signed char... yes
616 checking for prototypes... yes
617 checking for variable length prototypes and stdarg.h... yes
618 checking for socketpair... yes
619 checking if sockaddr has sa_len member... no
620 checking for gethostbyname_r... yes
621 checking gethostbyname_r with 6 args... yes
622 checking for __fpu_control... yes
623 checking for --with-libm=STRING... default LIBM="-lm"
624 checking for --with-libc=STRING... default LIBC=""
625 checking for x64 gcc inline assembler... yes
626 checking whether float word ordering is bigendian... no
627 checking whether we can use gcc inline assembler to get and set x87 control word... yes
628 checking whether we can use gcc inline assembler to get and set mc68881 fpcr... no
629 checking for x87-style double rounding... no
630 checking for acosh... yes
631 checking for asinh... yes
632 checking for atanh... yes
633 checking for copysign... yes
634 checking for erf... yes
635 checking for erfc... yes
636 checking for expm1... yes
637 checking for finite... yes
638 checking for gamma... yes
639 checking for hypot... yes
640 checking for lgamma... yes
641 checking for log1p... yes
642 checking for log2... yes
643 checking for round... yes
644 checking for tgamma... yes
645 checking whether isinf is declared... yes
646 checking whether isnan is declared... yes
647 checking whether isfinite is declared... yes
648 checking whether POSIX semaphores are enabled... yes
649 checking for broken sem_getvalue... no
650 checking whether RTLD_LAZY is declared... yes
651 checking whether RTLD_NOW is declared... yes
652 checking whether RTLD_GLOBAL is declared... yes
653 checking whether RTLD_LOCAL is declared... yes
654 checking whether RTLD_NODELETE is declared... yes
655 checking whether RTLD_NOLOAD is declared... yes
656 checking whether RTLD_DEEPBIND is declared... yes
657 checking whether RTLD_MEMBER is declared... no
658 checking digit size for Python's longs... no value specified
659 checking wchar.h usability... yes
660 checking wchar.h presence... yes
661 checking for wchar.h... yes
662 checking size of wchar_t... 4
663 checking for UCS-4 tcl... no
664 checking whether wchar_t is signed... yes
665 checking whether wchar_t is usable... no
666 checking whether byte ordering is bigendian... no
667 checking ABIFLAGS...
668 checking SOABI... cpython-38-x86_64-linux-gnu
669 checking LDVERSION... $(VERSION)$(ABIFLAGS)
670 checking whether right shift extends the sign bit... yes
671 checking for getc_unlocked() and friends... yes
672 checking how to link readline libs... -lreadline
673 checking for rl_pre_input_hook in -lreadline... yes
674 checking for rl_completion_display_matches_hook in -lreadline... yes
675 checking for rl_resize_terminal in -lreadline... yes
676 checking for rl_completion_matches in -lreadline... yes
677 checking for append_history in -lreadline... yes
678 checking for broken nice()... no
679 checking for broken poll()... no
680 checking for working tzset()... yes
681 checking for tv_nsec in struct stat... yes
682 checking for tv_nsec2 in struct stat... no
683 checking curses.h usability... yes
684 checking curses.h presence... yes
685 checking for curses.h... yes
686 checking ncurses.h usability... yes
687 checking ncurses.h presence... yes
688 checking for ncurses.h... yes
689 checking for term.h... yes
690 checking whether mvwdelch is an expression... yes
691 checking whether WINDOW has _flags... yes
692 checking for is_pad... yes
693 checking for is_term_resized... yes
694 checking for resize_term... yes
695 checking for resizeterm... yes
696 checking for immedok... yes
697 checking for syncok... yes
698 checking for wchgat... yes
699 checking for filter... yes
700 checking for has_key... yes
701 checking for typeahead... yes
702 checking for use_env... yes
703 configure: checking for device files
704 checking for /dev/ptmx... yes
705 checking for /dev/ptc... no
706 checking for %zd printf() format support... yes
707 checking for socklen_t... yes
708 checking for broken mbstowcs... no
709 checking for --with-computed-gotos... no value specified
710 checking whether gcc -pthread supports computed gotos... yes
711 checking for build directories... done
712 checking for -O2... yes
713 checking for glibc _FORTIFY_SOURCE/memmove bug... no
714 checking for gcc ipa-pure-const bug... no
715 checking for stdatomic.h... no
716 checking for GCC >= 4.7 __atomic builtins... yes
717 checking for ensurepip... upgrade
718 checking if the dirent structure of a d_type field... yes
719 checking for the Linux getrandom() syscall... yes
720 checking for the getrandom() function... no
721 checking for library containing shm_open... -lrt
722 checking for sys/mman.h... (cached) yes
723 checking for shm_open... yes
724 checking for shm_unlink... yes
725 checking for pkg-config... /usr/bin/pkg-config
726 checking whether compiling and linking against OpenSSL works... yes
727 checking for X509_VERIFY_PARAM_set1_host in libssl... yes
728 checking for --with-ssl-default-suites... python
729 configure: creating ./config.status
730 config.status: creating Makefile.pre
731 config.status: creating Misc/python.pc
732 config.status: creating Misc/python-embed.pc
733 config.status: creating Misc/python-config.sh
734 config.status: creating Modules/ld_so_aix
735 config.status: creating pyconfig.h
736 config.status: pyconfig.h is unchanged
737 creating Modules/Setup.local
738 creating Makefile
739 [root@kycxnode111 Python-3.8.4]#
5、编译安装

切入到解压目录下

make && make install

发现出现如下错误

查阅资料可知 是在configure 时使用 --enable-optimizations 导致的 看来上面的操作是多此一举了

 参考链接:https://bugs.python.org/issue34112

重新执行

./configure --prefix=/usr/local/python3

make && make install
..........
rm -f /usr/local/bin/pydoc3
(cd /usr/local/bin; ln -s pydoc3.8 pydoc3)
rm -f /usr/local/bin/2to3
(cd /usr/local/bin; ln -s 2to3-3.8 2to3)
if test "x" != "x" ; then 
        rm -f /usr/local/bin/python3-32; 
        (cd /usr/local/bin; ln -s python3.8-32 python3-32) 
fi
rm -f /usr/local/share/man/man1/python3.1
(cd /usr/local/share/man/man1; ln -s python3.8.1 python3.1)
if test "xupgrade" != "xno"  ; then 
        case upgrade in 
                upgrade) ensurepip="--upgrade" ;; 
                install|*) ensurepip="" ;; 
        esac; 
         ./python -E -m ensurepip 
                $ensurepip --root=/ ; 
fi
Looking in links: /tmp/tmplhwofxk0
Processing /tmp/tmplhwofxk0/setuptools-47.1.0-py3-none-any.whl
Processing /tmp/tmplhwofxk0/pip-20.1.1-py2.py3-none-any.whl
Installing collected packages: setuptools, pip
Successfully installed pip-20.1.1 setuptools-47.1.0

#至此安装结束
6、配置软连接
ln -s /usr/local/python3/bin/python3 /usr/bin/python3

ps:因为在创建后有错误在,需要先删除再创建

[root@kycxnode111 bin]# 
ln -s /usr/local/python3/bin/python3 /usr/bin/python3
ln: 无法创建符号链接"/usr/bin/python3": 文件已存在 [root@kycxnode111 bin]# rm -rf /usr/bin/python3
[root@kycxnode111 /]# which pip3
/usr/local/bin/pip3
[root@kycxnode111 /]# pip3 install selenium
Collecting selenium
  Downloading selenium-3.141.0-py2.py3-none-any.whl (904 kB)
     |████████████████████████████████| 904 kB 98 kB/s
Collecting urllib3
  Downloading urllib3-1.25.10-py2.py3-none-any.whl (127 kB)
     |████████████████████████████████| 127 kB 95 kB/s
Installing collected packages: urllib3, selenium
Successfully installed selenium-3.141.0 urllib3-1.25.10
[root@kycxnode111 /]# type pip3
pip3 已被哈希 (/usr/local/bin/pip3)
[root@kycxnode111 /]# hash -r
[root@kycxnode111 /]# type pip3
pip3 是 /usr/local/bin/pip3
[root@kycxnode111 /]#

7、为pip3 创建软连接

ln -s /usr/local/python3/bin/python3 /usr/bin/pip3 

 但是看上面的命令 软链接并没有起到作用,但是pip3 目前可以全局正常使用,具体什么原因导致的目前还暂无定论

至此 python3 和pip3 安装成功

原文地址:https://www.cnblogs.com/ningy1009/p/13594586.html