银河麒麟高级服务器操作系统(通用)安装和编译指定的python3版本
银河麒麟高级服务器操作系统(通用)安装和编译指定的python3版本
- 一 系统环境
- 二 安装python3.12.4
- 2.1 安装编译需要的依赖包
- 2.2 下载官网目前最新的python源码包
- 2.3 解压Python-3.12.4.tar.xz
- 2.4 配置python-3.12.4
- 2.5 编译安装
- 2.6 配置环境变量使其生效
- 2.7 检查是否安装成功
- 2.8 编写交互式测试程序测试
前言
1、对于一些场景中系统自带的python3.7.5版本无法满足使用需求,需要在环境中安装,编译指定版本的python3,以下详细列出了python3源码编译,安装,以及环境变量配置和使用步骤。
2、以下使用V10 SP3 x86架构操作系统做演示,对于不同架构,不同版本的系统,安装步骤同理!
一 系统环境
[root@localhost ~]# nkvers
############## Kylin Linux Version #################
Release:
Kylin Linux Advanced Server release V10 (Lance)Kernel:
4.19.90-52.22.v2207.ky10.x86_64Build:
Kylin Linux Advanced Server
release V10 (SP3) /(Lance)-x86_64-Build23/20230324
#################################################
二 安装python3.12.4
2.1 安装编译需要的依赖包
如果网络可以正常连接互联网,直接执行,如果不能访问外网,需要将ISO镜像文件配置成本地yum源!!
[root@localhost ~]# yum install libffi-devel tcl-devel tk-devel perl-CPAN openssl-devel readline-devel sqlite-devel openssl -y
2.2 下载官网目前最新的python源码包
[root@localhost ~]# wget https://www.python.org/ftp/python/3.12.4/Python-3.12.4.tar.xz
--2024-07-04 09:15:09-- https://www.python.org/ftp/python/3.12.4/Python-3.12.4.tar.xz
正在解析主机 www.python.org (www.python.org)... 146.75.112.223, 2a04:4e42:8c::223
正在连接 www.python.org (www.python.org)|146.75.112.223|:443... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:20659356 (20M) [application/octet-stream]
正在保存至: “Python-3.12.4.tar.xz”Python-3.12.4.tar.xz 100%[=====================================================================================================>] 19.70M 1.48MB/s 用时 43s 2024-07-04 09:15:53 (467 KB/s) - 已保存 “Python-3.12.4.tar.xz” [20659356/20659356])
2.3 解压Python-3.12.4.tar.xz
[root@localhost ~]# ls
anaconda-ks.cfg initial-setup-ks.cfg Python-3.12.4.tar.xz test.py
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]# tar xf Python-3.12.4.tar.xz
[root@localhost ~]#
[root@localhost ~]# cd Python-3.12.4
[root@localhost Python-3.12.4]# ls
aclocal.m4 config.sub configure.ac Grammar install-sh LICENSE Makefile.pre.in Modules Parser PCbuild pyconfig.h.in README.rst
config.guess configure Doc Include Lib Mac Misc Objects PC Programs Python Tools
[root@localhost Python-3.12.4]#
2.4 配置python-3.12.4
[root@localhost Python-3.12.4]#./configure --prefix=/opt/python3 --enable-optimizations......
checking for chown... yes
checking for clock... yes
checking for close_range... no
checking for confstr... yes
checking for copy_file_range... yes
checking for ctermid... yes
checking for dup... yes
checking for dup3... yes
checking for execv... yes
checking for explicit_bzero... yes
checking for explicit_memset... no
checking for faccessat... yes
checking for fchmod... yes
checking for fchmodat... yes
checking for fchown... yes
checking for fchownat... yes
checking for fdopendir... yes
checking for fdwalk... no
checking for fexecve... yes
checking for fork... yes
checking for fork1... no
checking for fpathconf... yes
checking for fstatat... yes
checking for ftime... yes
checking for ftruncate... yes
checking for futimens... yes
checking for futimes... yes
checking for futimesat... yes
checking for gai_strerror... yes
checking for getegid... yes
checking for getentropy... yes
checking for geteuid... yes
checking for getgid... yes
checking for getgrgid... yes
checking for getgrgid_r... yes
checking for getgrnam_r... yes
checking for getgrouplist... yes
checking for getgroups... yes
checking for gethostname... yes
checking for getitimer... yes
checking for getloadavg... yes
checking for getlogin... yes
checking for getpeername... yes
checking for getpgid... yes
checking for getpid... yes
checking for getppid... yes
checking for getpriority... yes
checking for _getpty... no
checking for getpwent... yes
checking for getpwnam_r... yes
checking for getpwuid... yes
checking for getpwuid_r... yes
checking for getresgid... yes
checking for getresuid... yes
checking for getrusage... yes
checking for getsid... yes
checking for getspent... yes
checking for getspnam... yes
checking for getuid... yes
checking for getwd... yes
checking for if_nameindex... yes
checking for initgroups... yes
checking for kill... yes
checking for killpg... yes
checking for lchown... yes
checking for linkat... yes
checking for lockf... yes
checking for lstat... yes
checking for lutimes... yes
checking for madvise... yes
checking for mbrtowc... yes
checking for memrchr... yes
checking for mkdirat... yes
checking for mkfifo... yes
checking for mkfifoat... yes
checking for mknod... yes
checking for mknodat... yes
checking for mktime... yes
checking for mmap... yes
checking for mremap... yes
checking for nice... yes
checking for openat... yes
checking for opendir... yes
checking for pathconf... yes
checking for pause... yes
checking for pipe... yes
checking for pipe2... yes
checking for plock... no
checking for poll... yes
checking for posix_fadvise... yes
checking for posix_fallocate... yes
checking for posix_spawn... yes
checking for posix_spawnp... yes
checking for pread... yes
checking for preadv... yes
checking for preadv2... yes
checking for pthread_condattr_setclock... yes
checking for pthread_init... no
checking for pthread_kill... yes
checking for pwrite... yes
checking for pwritev... yes
checking for pwritev2... yes
checking for readlink... yes
checking for readlinkat... yes
checking for readv... yes
checking for realpath... yes
checking for renameat... yes
checking for rtpSpawn... no
checking for sched_get_priority_max... yes
checking for sched_rr_get_interval... yes
checking for sched_setaffinity... yes
checking for sched_setparam... yes
checking for sched_setscheduler... yes
checking for sem_clockwait... no
checking for sem_getvalue... yes
checking for sem_open... yes
checking for sem_timedwait... yes
checking for sem_unlink... yes
checking for sendfile... yes
checking for setegid... yes
checking for seteuid... yes
checking for setgid... yes
checking for sethostname... yes
checking for setitimer... yes
checking for setlocale... yes
checking for setpgid... yes
checking for setpgrp... yes
checking for setpriority... yes
checking for setregid... yes
checking for setresgid... yes
checking for setresuid... yes
checking for setreuid... yes
checking for setsid... yes
checking for setuid... yes
checking for setvbuf... yes
checking for shutdown... yes
checking for sigaction... yes
checking for sigaltstack... yes
checking for sigfillset... yes
checking for siginterrupt... yes
checking for sigpending... yes
checking for sigrelse... yes
checking for sigtimedwait... yes
checking for sigwait... yes
checking for sigwaitinfo... yes
checking for snprintf... yes
checking for splice... yes
checking for strftime... yes
checking for strlcpy... no
checking for strsignal... yes
checking for symlinkat... yes
checking for sync... yes
checking for sysconf... yes
checking for system... yes
checking for tcgetpgrp... yes
checking for tcsetpgrp... yes
checking for tempnam... yes
checking for timegm... yes
checking for times... yes
checking for tmpfile... yes
checking for tmpnam... yes
checking for tmpnam_r... yes
checking for truncate... yes
checking for ttyname... yes
checking for umask... yes
checking for uname... yes
checking for unlinkat... yes
checking for utimensat... yes
checking for utimes... yes
checking for vfork... yes
checking for wait... yes
checking for wait3... yes
checking for wait4... yes
checking for waitid... yes
checking for waitpid... yes
checking for wcscoll... yes
checking for wcsftime... yes
checking for wcsxfrm... yes
checking for wmemcmp... yes
checking for writev... yes
checking for gcc -pthread options needed to detect all undeclared functions... none needed
checking whether dirfd is declared... yes
checking for chroot... yes
checking for link... yes
checking for symlink... yes
checking for fchdir... yes
checking for fsync... yes
checking for fdatasync... yes
checking for epoll_create... yes
checking for epoll_create1... yes
checking for kqueue... no
checking for prlimit... yes
checking for _dyld_shared_cache_contains_path... no
checking for memfd_create... yes
checking for eventfd... yes
checking for ctermid_r... no
checking for flock declaration... yes
checking for flock... yes
checking for getpagesize... yes
checking for broken unsetenv... no
checking for true... true
checking for inet_aton in -lc... yes
checking for chflags... no
checking for lchflags... no
checking for zlib >= 1.2.0... yes
checking for bzip2... yes
checking for liblzma... yes
checking for hstrerror... yes
checking for getservbyname... yes
checking for getservbyport... yes
checking for gethostbyname... yes
checking for gethostbyaddr... yes
checking for getprotobyname... yes
checking for inet_aton... yes
checking for inet_ntoa... yes
checking for inet_pton... yes
checking for getpeername... (cached) yes
checking for getsockname... yes
checking for accept... yes
checking for bind... yes
checking for connect... yes
checking for listen... yes
checking for recvfrom... yes
checking for sendto... yes
checking for setsockopt... yes
checking for socket... yes
checking for setgroups... yes
checking for openpty... no
checking for openpty in -lutil... yes
checking for library containing login_tty... none required
checking for forkpty... yes
checking for fseek64... no
checking for fseeko... yes
checking for fstatvfs... yes
checking for ftell64... no
checking for ftello... yes
checking for statvfs... yes
checking for dup2... yes
checking for getpgrp... yes
checking for setpgrp... (cached) yes
checking for setns... yes
checking for unshare... yes
checking for libxcrypt >= 3.1.1... yes
checking for crypt or crypt_r... yes
checking for clock_gettime... yes
checking for clock_getres... yes
checking for clock_settime... yes
checking for clock_nanosleep... yes
checking for nanosleep... yes
checking for major, minor, and makedev... yes
checking for getaddrinfo... yes
checking getaddrinfo bug... no
checking for getnameinfo... yes
checking whether struct tm is in sys/time.h or time.h... time.h
checking for struct tm.tm_zone... yes
checking for struct stat.st_rdev... yes
checking for struct stat.st_blksize... yes
checking for struct stat.st_flags... no
checking for struct stat.st_gen... no
checking for struct stat.st_birthtime... no
checking for struct stat.st_blocks... yes
checking for struct passwd.pw_gecos... yes
checking for struct passwd.pw_passwd... yes
checking for siginfo_t.si_band... yes
checking for time.h that defines altzone... no
checking for addrinfo... yes
checking for sockaddr_storage... yes
checking for sockaddr_alg... yes
checking for an ANSI C-conforming const... yes
checking for working signed char... yes
checking for prototypes... yes
checking for socketpair... yes
checking if sockaddr has sa_len member... no
checking for gethostbyname_r... yes
checking gethostbyname_r with 6 args... yes
checking for __fpu_control... yes
checking for --with-libm=STRING... default LIBM="-lm"
checking for --with-libc=STRING... default LIBC=""
checking for x64 gcc inline assembler... yes
checking whether float word ordering is bigendian... no
checking whether we can use gcc inline assembler to get and set x87 control word... yes
checking whether we can use gcc inline assembler to get and set mc68881 fpcr... no
checking for x87-style double rounding... no
checking for acosh... yes
checking for asinh... yes
checking for atanh... yes
checking for erf... yes
checking for erfc... yes
checking for expm1... yes
checking for log1p... yes
checking for log2... yes
checking whether POSIX semaphores are enabled... yes
checking for broken sem_getvalue... no
checking whether RTLD_LAZY is declared... yes
checking whether RTLD_NOW is declared... yes
checking whether RTLD_GLOBAL is declared... yes
checking whether RTLD_LOCAL is declared... yes
checking whether RTLD_NODELETE is declared... yes
checking whether RTLD_NOLOAD is declared... yes
checking whether RTLD_DEEPBIND is declared... yes
checking whether RTLD_MEMBER is declared... no
checking digit size for Python's longs... no value specified
checking for wchar.h... (cached) yes
checking size of wchar_t... 4
checking whether wchar_t is signed... yes
checking whether wchar_t is usable... no
checking whether byte ordering is bigendian... no
checking ABIFLAGS...
checking SOABI... cpython-312-x86_64-linux-gnu
checking LDVERSION... $(VERSION)$(ABIFLAGS)
checking for --with-platlibdir... no
checking for --with-wheel-pkg-dir... no
checking whether right shift extends the sign bit... yes
checking for getc_unlocked() and friends... yes
checking for readline... yes
checking how to link readline... readline (CFLAGS: -I/usr/include/readline -D_DEFAULT_SOURCE , LIBS: -lreadline )
checking whether rl_completion_append_character is declared... yes
checking whether rl_completion_suppress_append is declared... yes
checking for rl_pre_input_hook in -lreadline... yes
checking for rl_completion_display_matches_hook in -lreadline... yes
checking for rl_resize_terminal in -lreadline... yes
checking for rl_completion_matches in -lreadline... yes
checking whether rl_catch_signals is declared... yes
checking for append_history in -lreadline... yes
checking for rl_compdisp_func_t... yes
checking for broken nice()... no
checking for broken poll()... no
checking for working tzset()... yes
checking for tv_nsec in struct stat... yes
checking for tv_nsec2 in struct stat... no
checking for curses.h... yes
checking for ncurses.h... yes
checking for ncursesw... yes
checking curses module flags... ncursesw (CFLAGS: -D_DEFAULT_SOURCE , LIBS: -lncursesw -ltinfo )
checking for panel.h... yes
checking for panelw... yes
checking panel flags... panelw (CFLAGS: -D_DEFAULT_SOURCE , LIBS: -lpanelw )
checking for term.h... yes
checking whether mvwdelch is an expression... yes
checking whether WINDOW has _flags... yes
checking for curses function is_pad... yes
checking for curses function is_term_resized... yes
checking for curses function resize_term... yes
checking for curses function resizeterm... yes
checking for curses function immedok... yes
checking for curses function syncok... yes
checking for curses function wchgat... yes
checking for curses function filter... yes
checking for curses function has_key... yes
checking for curses function typeahead... yes
checking for curses function use_env... yes
configure: checking for device files
checking for /dev/ptmx... yes
checking for /dev/ptc... no
checking for socklen_t... yes
checking for broken mbstowcs... no
checking for --with-computed-gotos... no value specified
checking whether gcc -pthread supports computed gotos... yes
checking for build directories... done
checking for -O2... yes
checking for glibc _FORTIFY_SOURCE/memmove bug... no
checking for gcc ipa-pure-const bug... no
checking for stdatomic.h... yes
checking for builtin __atomic_load_n and __atomic_store_n functions... yes
checking for ensurepip... upgrade
checking if the dirent structure of a d_type field... yes
checking for the Linux getrandom() syscall... yes
checking for the getrandom() function... yes
checking for library containing shm_open... -lrt
checking for shm_open... yes
checking for shm_unlink... yes
checking for pkg-config... /bin/pkg-config
checking whether compiling and linking against OpenSSL works... yes
checking for --with-openssl-rpath...
checking whether OpenSSL provides required ssl module APIs... yes
checking whether OpenSSL provides required hashlib module APIs... yes
checking for --with-ssl-default-suites... python
checking for --with-builtin-hashlib-hashes... md5,sha1,sha2,sha3,blake2
checking for libb2... no
checking for --disable-test-modules... yes
checking for stdlib extension module _multiprocessing... yes
checking for stdlib extension module _posixshmem... yes
checking for stdlib extension module fcntl... yes
checking for stdlib extension module mmap... yes
checking for stdlib extension module _socket... yes
checking for stdlib extension module grp... yes
checking for stdlib extension module ossaudiodev... yes
checking for stdlib extension module pwd... yes
checking for stdlib extension module resource... yes
checking for stdlib extension module _scproxy... n/a
checking for stdlib extension module spwd... yes
checking for stdlib extension module syslog... yes
checking for stdlib extension module termios... yes
checking for stdlib extension module pyexpat... yes
checking for stdlib extension module _elementtree... yes
checking for stdlib extension module _md5... yes
checking for stdlib extension module _sha1... yes
checking for stdlib extension module _sha2... yes
checking for stdlib extension module _sha3... yes
checking for stdlib extension module _blake2... yes
checking for stdlib extension module _crypt... yes
checking for stdlib extension module _ctypes... yes
checking for stdlib extension module _curses... yes
checking for stdlib extension module _curses_panel... yes
checking for stdlib extension module _decimal... yes
checking for stdlib extension module _dbm... missing
checking for stdlib extension module _gdbm... missing
checking for stdlib extension module nis... missing
checking for stdlib extension module readline... yes
checking for stdlib extension module _sqlite3... yes
checking for stdlib extension module _tkinter... yes
checking for stdlib extension module _uuid... missing
checking for stdlib extension module zlib... yes
checking for stdlib extension module _bz2... yes
checking for stdlib extension module _lzma... yes
checking for stdlib extension module _ssl... yes
checking for stdlib extension module _hashlib... yes
checking for stdlib extension module _testcapi... yes
checking for stdlib extension module _testclinic... yes
checking for stdlib extension module _testinternalcapi... yes
checking for stdlib extension module _testbuffer... yes
checking for stdlib extension module _testimportmultiple... yes
checking for stdlib extension module _testmultiphase... yes
checking for stdlib extension module xxsubtype... yes
checking for stdlib extension module _xxtestfuzz... yes
checking for stdlib extension module _ctypes_test... yes
checking for stdlib extension module xxlimited... yes
checking for stdlib extension module xxlimited_35... yes
configure: creating ./config.status
config.status: creating Makefile.pre
config.status: creating Misc/python.pc
config.status: creating Misc/python-embed.pc
config.status: creating Misc/python-config.sh
config.status: creating Modules/Setup.bootstrap
config.status: creating Modules/Setup.stdlib
config.status: creating Modules/ld_so_aix
config.status: creating pyconfig.h
configure: creating Modules/Setup.local
configure: creating Makefile
[root@localhost Python-3.12.4]#
2.5 编译安装
[root@localhost Python-3.12.4]# make && make install
if test "no-framework" = "no-framework" ; then \/bin/install -c python /opt/python3/bin/python3.12; \
else \/bin/install -c -s Mac/pythonw /opt/python3/bin/python3.12; \
fi
if test "3.12" != "3.12"; then \if test -f /opt/python3/bin/python3.12 -o -h /opt/python3/bin/python3.12; \then rm -f /opt/python3/bin/python3.12; \fi; \(cd /opt/python3/bin; ln python3.12 python3.12); \
fi
if test "x" != "x" ; then \rm -f /opt/python3/bin/python3.12-32; \lipo \-output /opt/python3/bin/python3.12-32 \/opt/python3/bin/python3.12; \
fi
if test "x" != "x" ; then \rm -f /opt/python3/bin/python3.12-intel64; \lipo \-output /opt/python3/bin/python3.12-intel64 \/opt/python3/bin/python3.12; \
fi
# Install macOS debug information (if available)
if test -d "python.dSYM"; then \echo /opt/python3/bin/python3.12; \/opt/python3/bin/python3.12; \
fi
if test "no-framework" = "no-framework" ; then \if test -d "libpython3.12.a.dSYM"; then \echo /opt/python3/lib/libpython3.12.a; \/opt/python3/lib/libpython3.12.a; \fi \
else \if test -d "libpython3.12.a.dSYM"; then \echo /libpython3.12.a; \/libpython3.12.a; \fi \
fi
Rebuilding with profile guided optimizations:
rm -f profile-clean-stamp
make build_all CFLAGS_NODIST=" -fprofile-use -fprofile-correction" LDFLAGS_NODIST=""
make[1]: 进入目录“/root/Python-3.12.4”
The necessary bits to build these optional modules were not found:
_dbm _gdbm _uuid
nis
To find the necessary bits, look in configure.ac and config.log.
......
......
......
......
......
......
/bin/install -c -m 755 Modules/_bisect.cpython-312-x86_64-linux-gnu.so /opt/python3/lib/python3.12/lib-dynload/_bisect.cpython-312-x86_64-linux-gnu.so
/bin/install -c -m 755 Modules/_contextvars.cpython-312-x86_64-linux-gnu.so /opt/python3/lib/python3.12/lib-dynload/_contextvars.cpython-312-x86_64-linux-gnu.so
/bin/install -c -m 755 Modules/_csv.cpython-312-x86_64-linux-gnu.so /opt/python3/lib/python3.12/lib-dynload/_csv.cpython-312-x86_64-linux-gnu.so
/bin/install -c -m 755 Modules/_heapq.cpython-312-x86_64-linux-gnu.so /opt/python3/lib/python3.12/lib-dynload/_heapq.cpython-312-x86_64-linux-gnu.so
/bin/install -c -m 755 Modules/_json.cpython-312-x86_64-linux-gnu.so /opt/python3/lib/python3.12/lib-dynload/_json.cpython-312-x86_64-linux-gnu.so
/bin/install -c -m 755 Modules/_lsprof.cpython-312-x86_64-linux-gnu.so /opt/python3/lib/python3.12/lib-dynload/_lsprof.cpython-312-x86_64-linux-gnu.so
/bin/install -c -m 755 Modules/_opcode.cpython-312-x86_64-linux-gnu.so /opt/python3/lib/python3.12/lib-dynload/_opcode.cpython-312-x86_64-linux-gnu.so
/bin/install -c -m 755 Modules/_pickle.cpython-312-x86_64-linux-gnu.so /opt/python3/lib/python3.12/lib-dynload/_pickle.cpython-312-x86_64-linux-gnu.so
/bin/install -c -m 755 Modules/_queue.cpython-312-x86_64-linux-gnu.so /opt/python3/lib/python3.12/lib-dynload/_queue.cpython-312-x86_64-linux-gnu.so
/bin/install -c -m 755 Modules/_random.cpython-312-x86_64-linux-gnu.so /opt/python3/lib/python3.12/lib-dynload/_random.cpython-312-x86_64-linux-gnu.so
/bin/install -c -m 755 Modules/_struct.cpython-312-x86_64-linux-gnu.so /opt/python3/lib/python3.12/lib-dynload/_struct.cpython-312-x86_64-linux-gnu.so
/bin/install -c -m 755 Modules/_xxsubinterpreters.cpython-312-x86_64-linux-gnu.so /opt/python3/lib/python3.12/lib-dynload/_xxsubinterpreters.cpython-312-x86_64-linux-gnu.so
/bin/install -c -m 755 Modules/_xxinterpchannels.cpython-312-x86_64-linux-gnu.so /opt/python3/lib/python3.12/lib-dynload/_xxinterpchannels.cpython-312-x86_64-linux-gnu.so
/bin/install -c -m 755 Modules/_zoneinfo.cpython-312-x86_64-linux-gnu.so /opt/python3/lib/python3.12/lib-dynload/_zoneinfo.cpython-312-x86_64-linux-gnu.so
/bin/install -c -m 755 Modules/audioop.cpython-312-x86_64-linux-gnu.so /opt/python3/lib/python3.12/lib-dynload/audioop.cpython-312-x86_64-linux-gnu.so
/bin/install -c -m 755 Modules/math.cpython-312-x86_64-linux-gnu.so /opt/python3/lib/python3.12/lib-dynload/math.cpython-312-x86_64-linux-gnu.so
/bin/install -c -m 755 Modules/cmath.cpython-312-x86_64-linux-gnu.so /opt/python3/lib/python3.12/lib-dynload/cmath.cpython-312-x86_64-linux-gnu.so
/bin/install -c -m 755 Modules/_statistics.cpython-312-x86_64-linux-gnu.so /opt/python3/lib/python3.12/lib-dynload/_statistics.cpython-312-x86_64-linux-gnu.so
/bin/install -c -m 755 Modules/_datetime.cpython-312-x86_64-linux-gnu.so /opt/python3/lib/python3.12/lib-dynload/_datetime.cpython-312-x86_64-linux-gnu.so
/bin/install -c -m 755 Modules/_decimal.cpython-312-x86_64-linux-gnu.so /opt/python3/lib/python3.12/lib-dynload/_decimal.cpython-312-x86_64-linux-gnu.so
/bin/install -c -m 755 Modules/binascii.cpython-312-x86_64-linux-gnu.so /opt/python3/lib/python3.12/lib-dynload/binascii.cpython-312-x86_64-linux-gnu.so
/bin/install -c -m 755 Modules/_bz2.cpython-312-x86_64-linux-gnu.so /opt/python3/lib/python3.12/lib-dynload/_bz2.cpython-312-x86_64-linux-gnu.so
/bin/install -c -m 755 Modules/_lzma.cpython-312-x86_64-linux-gnu.so /opt/python3/lib/python3.12/lib-dynload/_lzma.cpython-312-x86_64-linux-gnu.so
/bin/install -c -m 755 Modules/zlib.cpython-312-x86_64-linux-gnu.so /opt/python3/lib/python3.12/lib-dynload/zlib.cpython-312-x86_64-linux-gnu.so
/bin/install -c -m 755 Modules/readline.cpython-312-x86_64-linux-gnu.so /opt/python3/lib/python3.12/lib-dynload/readline.cpython-312-x86_64-linux-gnu.so
/bin/install -c -m 755 Modules/_md5.cpython-312-x86_64-linux-gnu.so /opt/python3/lib/python3.12/lib-dynload/_md5.cpython-312-x86_64-linux-gnu.so
/bin/install -c -m 755 Modules/_sha1.cpython-312-x86_64-linux-gnu.so /opt/python3/lib/python3.12/lib-dynload/_sha1.cpython-312-x86_64-linux-gnu.so
/bin/install -c -m 755 Modules/_sha2.cpython-312-x86_64-linux-gnu.so /opt/python3/lib/python3.12/lib-dynload/_sha2.cpython-312-x86_64-linux-gnu.so
/bin/install -c -m 755 Modules/_sha3.cpython-312-x86_64-linux-gnu.so /opt/python3/lib/python3.12/lib-dynload/_sha3.cpython-312-x86_64-linux-gnu.so
/bin/install -c -m 755 Modules/_blake2.cpython-312-x86_64-linux-gnu.so /opt/python3/lib/python3.12/lib-dynload/_blake2.cpython-312-x86_64-linux-gnu.so
/bin/install -c -m 755 Modules/pyexpat.cpython-312-x86_64-linux-gnu.so /opt/python3/lib/python3.12/lib-dynload/pyexpat.cpython-312-x86_64-linux-gnu.so
/bin/install -c -m 755 Modules/_elementtree.cpython-312-x86_64-linux-gnu.so /opt/python3/lib/python3.12/lib-dynload/_elementtree.cpython-312-x86_64-linux-gnu.so
/bin/install -c -m 755 Modules/_codecs_cn.cpython-312-x86_64-linux-gnu.so /opt/python3/lib/python3.12/lib-dynload/_codecs_cn.cpython-312-x86_64-linux-gnu.so
/bin/install -c -m 755 Modules/_codecs_hk.cpython-312-x86_64-linux-gnu.so /opt/python3/lib/python3.12/lib-dynload/_codecs_hk.cpython-312-x86_64-linux-gnu.so
/bin/install -c -m 755 Modules/_codecs_iso2022.cpython-312-x86_64-linux-gnu.so /opt/python3/lib/python3.12/lib-dynload/_codecs_iso2022.cpython-312-x86_64-linux-gnu.so
/bin/install -c -m 755 Modules/_codecs_jp.cpython-312-x86_64-linux-gnu.so /opt/python3/lib/python3.12/lib-dynload/_codecs_jp.cpython-312-x86_64-linux-gnu.so
/bin/install -c -m 755 Modules/_codecs_kr.cpython-312-x86_64-linux-gnu.so /opt/python3/lib/python3.12/lib-dynload/_codecs_kr.cpython-312-x86_64-linux-gnu.so
/bin/install -c -m 755 Modules/_codecs_tw.cpython-312-x86_64-linux-gnu.so /opt/python3/lib/python3.12/lib-dynload/_codecs_tw.cpython-312-x86_64-linux-gnu.so
/bin/install -c -m 755 Modules/_multibytecodec.cpython-312-x86_64-linux-gnu.so /opt/python3/lib/python3.12/lib-dynload/_multibytecodec.cpython-312-x86_64-linux-gnu.so
/bin/install -c -m 755 Modules/unicodedata.cpython-312-x86_64-linux-gnu.so /opt/python3/lib/python3.12/lib-dynload/unicodedata.cpython-312-x86_64-linux-gnu.so
/bin/install -c -m 755 Modules/_crypt.cpython-312-x86_64-linux-gnu.so /opt/python3/lib/python3.12/lib-dynload/_crypt.cpython-312-x86_64-linux-gnu.so
/bin/install -c -m 755 Modules/fcntl.cpython-312-x86_64-linux-gnu.so /opt/python3/lib/python3.12/lib-dynload/fcntl.cpython-312-x86_64-linux-gnu.so
/bin/install -c -m 755 Modules/grp.cpython-312-x86_64-linux-gnu.so /opt/python3/lib/python3.12/lib-dynload/grp.cpython-312-x86_64-linux-gnu.so
/bin/install -c -m 755 Modules/mmap.cpython-312-x86_64-linux-gnu.so /opt/python3/lib/python3.12/lib-dynload/mmap.cpython-312-x86_64-linux-gnu.so
/bin/install -c -m 755 Modules/ossaudiodev.cpython-312-x86_64-linux-gnu.so /opt/python3/lib/python3.12/lib-dynload/ossaudiodev.cpython-312-x86_64-linux-gnu.so
/bin/install -c -m 755 Modules/_posixsubprocess.cpython-312-x86_64-linux-gnu.so /opt/python3/lib/python3.12/lib-dynload/_posixsubprocess.cpython-312-x86_64-linux-gnu.so
/bin/install -c -m 755 Modules/resource.cpython-312-x86_64-linux-gnu.so /opt/python3/lib/python3.12/lib-dynload/resource.cpython-312-x86_64-linux-gnu.so
/bin/install -c -m 755 Modules/select.cpython-312-x86_64-linux-gnu.so /opt/python3/lib/python3.12/lib-dynload/select.cpython-312-x86_64-linux-gnu.so
/bin/install -c -m 755 Modules/_socket.cpython-312-x86_64-linux-gnu.so /opt/python3/lib/python3.12/lib-dynload/_socket.cpython-312-x86_64-linux-gnu.so
/bin/install -c -m 755 Modules/spwd.cpython-312-x86_64-linux-gnu.so /opt/python3/lib/python3.12/lib-dynload/spwd.cpython-312-x86_64-linux-gnu.so
/bin/install -c -m 755 Modules/syslog.cpython-312-x86_64-linux-gnu.so /opt/python3/lib/python3.12/lib-dynload/syslog.cpython-312-x86_64-linux-gnu.so
/bin/install -c -m 755 Modules/termios.cpython-312-x86_64-linux-gnu.so /opt/python3/lib/python3.12/lib-dynload/termios.cpython-312-x86_64-linux-gnu.so
/bin/install -c -m 755 Modules/_posixshmem.cpython-312-x86_64-linux-gnu.so /opt/python3/lib/python3.12/lib-dynload/_posixshmem.cpython-312-x86_64-linux-gnu.so
/bin/install -c -m 755 Modules/_multiprocessing.cpython-312-x86_64-linux-gnu.so /opt/python3/lib/python3.12/lib-dynload/_multiprocessing.cpython-312-x86_64-linux-gnu.so
/bin/install -c -m 755 Modules/_ctypes.cpython-312-x86_64-linux-gnu.so /opt/python3/lib/python3.12/lib-dynload/_ctypes.cpython-312-x86_64-linux-gnu.so
/bin/install -c -m 755 Modules/_curses.cpython-312-x86_64-linux-gnu.so /opt/python3/lib/python3.12/lib-dynload/_curses.cpython-312-x86_64-linux-gnu.so
/bin/install -c -m 755 Modules/_curses_panel.cpython-312-x86_64-linux-gnu.so /opt/python3/lib/python3.12/lib-dynload/_curses_panel.cpython-312-x86_64-linux-gnu.so
/bin/install -c -m 755 Modules/_sqlite3.cpython-312-x86_64-linux-gnu.so /opt/python3/lib/python3.12/lib-dynload/_sqlite3.cpython-312-x86_64-linux-gnu.so
/bin/install -c -m 755 Modules/_ssl.cpython-312-x86_64-linux-gnu.so /opt/python3/lib/python3.12/lib-dynload/_ssl.cpython-312-x86_64-linux-gnu.so
/bin/install -c -m 755 Modules/_hashlib.cpython-312-x86_64-linux-gnu.so /opt/python3/lib/python3.12/lib-dynload/_hashlib.cpython-312-x86_64-linux-gnu.so
/bin/install -c -m 755 Modules/_tkinter.cpython-312-x86_64-linux-gnu.so /opt/python3/lib/python3.12/lib-dynload/_tkinter.cpython-312-x86_64-linux-gnu.so
/bin/install -c -m 755 Modules/xxsubtype.cpython-312-x86_64-linux-gnu.so /opt/python3/lib/python3.12/lib-dynload/xxsubtype.cpython-312-x86_64-linux-gnu.so
/bin/install -c -m 755 Modules/_xxtestfuzz.cpython-312-x86_64-linux-gnu.so /opt/python3/lib/python3.12/lib-dynload/_xxtestfuzz.cpython-312-x86_64-linux-gnu.so
/bin/install -c -m 755 Modules/_testbuffer.cpython-312-x86_64-linux-gnu.so /opt/python3/lib/python3.12/lib-dynload/_testbuffer.cpython-312-x86_64-linux-gnu.so
/bin/install -c -m 755 Modules/_testinternalcapi.cpython-312-x86_64-linux-gnu.so /opt/python3/lib/python3.12/lib-dynload/_testinternalcapi.cpython-312-x86_64-linux-gnu.so
/bin/install -c -m 755 Modules/_testcapi.cpython-312-x86_64-linux-gnu.so /opt/python3/lib/python3.12/lib-dynload/_testcapi.cpython-312-x86_64-linux-gnu.so
/bin/install -c -m 755 Modules/_testclinic.cpython-312-x86_64-linux-gnu.so /opt/python3/lib/python3.12/lib-dynload/_testclinic.cpython-312-x86_64-linux-gnu.so
/bin/install -c -m 755 Modules/_testimportmultiple.cpython-312-x86_64-linux-gnu.so /opt/python3/lib/python3.12/lib-dynload/_testimportmultiple.cpython-312-x86_64-linux-gnu.so
/bin/install -c -m 755 Modules/_testmultiphase.cpython-312-x86_64-linux-gnu.so /opt/python3/lib/python3.12/lib-dynload/_testmultiphase.cpython-312-x86_64-linux-gnu.so
/bin/install -c -m 755 Modules/_testsinglephase.cpython-312-x86_64-linux-gnu.so /opt/python3/lib/python3.12/lib-dynload/_testsinglephase.cpython-312-x86_64-linux-gnu.so
/bin/install -c -m 755 Modules/_ctypes_test.cpython-312-x86_64-linux-gnu.so /opt/python3/lib/python3.12/lib-dynload/_ctypes_test.cpython-312-x86_64-linux-gnu.so
/bin/install -c -m 755 Modules/xxlimited.cpython-312-x86_64-linux-gnu.so /opt/python3/lib/python3.12/lib-dynload/xxlimited.cpython-312-x86_64-linux-gnu.so
/bin/install -c -m 755 Modules/xxlimited_35.cpython-312-x86_64-linux-gnu.so /opt/python3/lib/python3.12/lib-dynload/xxlimited_35.cpython-312-x86_64-linux-gnu.so
/bin/install -c -m 644 ./Misc/python.man \/opt/python3/share/man/man1/python3.12.1
if test ! -d /opt/python3/lib/pkgconfig; then \echo "Creating directory /opt/python3/lib/pkgconfig"; \/bin/install -c -d -m 755 /opt/python3/lib/pkgconfig; \
fi
if test -f /opt/python3/bin/python3 -o -h /opt/python3/bin/python3; \
then rm -f /opt/python3/bin/python3; \
else true; \
fi
(cd /opt/python3/bin; ln -s python3.12 python3)
if test "3.12" != "3.12"; then \rm -f /opt/python3/bin/python3.12-config; \(cd /opt/python3/bin; ln -s python3.12-config python3.12-config); \rm -f /opt/python3/lib/pkgconfig/python-3.12.pc; \(cd /opt/python3/lib/pkgconfig; ln -s python-3.12.pc python-3.12.pc); \rm -f /opt/python3/lib/pkgconfig/python-3.12-embed.pc; \(cd /opt/python3/lib/pkgconfig; ln -s python-3.12-embed.pc python-3.12-embed.pc); \
fi
rm -f /opt/python3/bin/python3-config
(cd /opt/python3/bin; ln -s python3.12-config python3-config)
rm -f /opt/python3/lib/pkgconfig/python3.pc
(cd /opt/python3/lib/pkgconfig; ln -s python-3.12.pc python3.pc)
rm -f /opt/python3/lib/pkgconfig/python3-embed.pc
(cd /opt/python3/lib/pkgconfig; ln -s python-3.12-embed.pc python3-embed.pc)
rm -f /opt/python3/bin/idle3
(cd /opt/python3/bin; ln -s idle3.12 idle3)
rm -f /opt/python3/bin/pydoc3
(cd /opt/python3/bin; ln -s pydoc3.12 pydoc3)
rm -f /opt/python3/bin/2to3
(cd /opt/python3/bin; ln -s 2to3-3.12 2to3)
if test "x" != "x" ; then \rm -f /opt/python3/bin/python3-32; \(cd /opt/python3/bin; ln -s python3.12-32 python3-32) \
fi
if test "x" != "x" ; then \rm -f /opt/python3/bin/python3-intel64; \(cd /opt/python3/bin; ln -s python3.12-intel64 python3-intel64) \
fi
rm -f /opt/python3/share/man/man1/python3.1
(cd /opt/python3/share/man/man1; ln -s python3.12.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/tmpeykwgd2r
Requirement already satisfied: pip in /opt/python3/lib/python3.12/site-packages (24.0)
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
2.6 配置环境变量使其生效
[root@localhost ~]# echo "export PYTHON_HOME=/opt/python3" >> /etc/profile
[root@localhost ~]# echo "export PATH=$PYTHON_HOME/bin:$PATH" >> /etc/profile
[root@localhost ~]# source /etc/profile
2.7 检查是否安装成功
[root@localhost ~]# python3
Python 3.12.4 (main, Jul 4 2024, 09:38:24) [GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()
[root@localhost ~]# pip3 --version
pip 24.0 from /opt/python3/lib/python3.12/site-packages/pip (python 3.12)
[root@localhost ~]#
2.8 编写交互式测试程序测试
[root@localhost ~]# cat python3-test.py
#!/opt/python3
def add(x, y):return x + ydef subtract(x, y):return x - ydef multiply(x, y):return x * ydef divide(x, y):if y != 0:return x / yelse:return "除数不能为0"while True:print("选择运算:")print("1.加法")print("2.减法")print("3.乘法")print("4.除法")print("5.退出")choice = input("输入你的选择(1/2/3/4/5): ")if choice in ('1', '2', '3', '4'):num1 = float(input("输入第一个数字: "))num2 = float(input("输入第二个数字: "))if choice == '1':print("结果是:", add(num1, num2))elif choice == '2':print("结果是:", subtract(num1, num2))elif choice == '3':print("结果是:", multiply(num1, num2))elif choice == '4':print("结果是:", divide(num1, num2))elif choice == '5':print("退出程序。")breakelse:print("无效输入")[root@localhost ~]# python3 python3-test.py
选择运算:
1.加法
2.减法
3.乘法
4.除法
5.退出
输入你的选择(1/2/3/4/5): 1
输入第一个数字: 3
输入第二个数字: 65
结果是: 68.0
选择运算:
1.加法
2.减法
3.乘法
4.除法
5.退出
输入你的选择(1/2/3/4/5): 5
退出程序。
相关文章:
银河麒麟高级服务器操作系统(通用)安装和编译指定的python3版本
银河麒麟高级服务器操作系统(通用)安装和编译指定的python3版本 一 系统环境二 安装python3.12.42.1 安装编译需要的依赖包2.2 下载官网目前最新的python源码包2.3 解压Python-3.12.4.tar.xz2.4 配置python-3.12.42.5 编译安装2.6 配置环境变量使其生效2…...

cs231n 作业3
使用普通RNN进行图像标注 单个RNN神经元行为 前向传播: 反向传播: def rnn_step_backward(dnext_h, cache):dx, dprev_h, dWx, dWh, db None, None, None, None, Nonex, Wx, Wh, prev_h, next_h cachedtanh 1 - next_h**2dx (dnext_h*dtanh).dot(…...

HarmonyOS Next系列之Echarts图表组件(折线图、柱状图、饼图等)实现(八)
系列文章目录 HarmonyOS Next 系列之省市区弹窗选择器实现(一) HarmonyOS Next 系列之验证码输入组件实现(二) HarmonyOS Next 系列之底部标签栏TabBar实现(三) HarmonyOS Next 系列之HTTP请求封装和Token…...

网上怎么样可以挣钱,分享几种可以让你在家赚钱的兼职项目
当今社会,压力越来越大,工作、家庭、生活等等,方方面面都需要钱,仅靠一份工作赚钱,已经很难满足我们的需求。所以很多人都会尝试做一些副业,兼职来补贴家用。 现在呢,有很多人都想在网上赚钱&am…...
【DevOps】运维过程中经常遇到的Http错误码问题分析(二)
目录 一、HTTP 错误400 Bad Request 1、理解 400 Bad Request 错误 2、排查 400 Bad Request 错误 3、常见的解决方法 二、HTTP 错误401 Unauthorized 1、理解 401 Unauthorized 错误 2、排查 401 Unauthorized 错误 3、常见的解决方法 一、HTTP 错误400 Bad Request …...

数据结构练习
1. 快速排序的非递归是通过栈来实现的,则前序与层次可以通过控制入栈的顺序来实现,因为递归是会一直开辟栈区空间,所以非递归的实现只需要一个栈的大小,而这个大小是小于递归所要的, 非递归与递归的时间复杂度是一样的…...
手动安装Ruby 1.9.3并升级RubyGems
手动安装Ruby 1.9.3并升级RubyGems ###Ruby 1.9.3 p125安装 wget http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p125.tar.gz \ && tar -xzvf ruby-1.9.3-p125.tar.gz \ && cd ruby-1.9.3-p125 \ && ./configure --with-openssl-dir/usr/lib/op…...

go语言day11 错误 defer(),panic(),recover()
错误: 创建错误 1)fmt包下提供的方法 fmt.Errorf(" 格式化字符串信息 " , 空接口类型对象 ) 2)errors包下提供的方法 errors.New(" 字符串信息 ") 创建自定义错误 需要实现error接口,而error接口…...
构建docker镜像实战
构建docker镜像 构建基础容器镜像(Base Image)是创建容器化应用程序的第一步。基础镜像提供了一个最低限度的操作系统环境,您可以在其上安装所需的软件包和应用程序。 Dockerfile语法说明 Dockerfile 是 Docker 构建镜像的描述文件&#x…...
生信算法9 - 正则表达式匹配氨基酸序列、核型和字符串
建议在Jupyter实践。 1. 使用正则表达式匹配指定的氨基酸序列 import re# 氨基酸序列 seq VSVLTMFRYAGWLDRLYMLVGTQLAAIIHGVALPLMMLI# 正则表达式匹配 match re.search(r[A|G]W, seq)# 打印match及匹配到开始位置和结束位置 print(match) # <re.Match object; span(10, …...
linux ext2文件系统浅析
文章目录 前言ext2内容概述实验准备二进制对比分析1 super block2 group desc3 block bitmap4 inode bitmap5 inode_tableinode 1inode 2inode 11inode 12 6 dir entry7 data区8 间接块9 块组 前言 网上关于ext2文件系统的博客有很多,但看完之后还是有些云里雾里&a…...
「树莓派入门」树莓派进阶02-传感器应用与交通灯项目
传感器是树莓派实现智能化的关键。通过本教程,你可以开始尝试使用传感器来增强树莓派的功能。 一、传感器在树莓派中的作用 传感器是树莓派与外界环境交互的重要工具。它们可以检测各种物理量,如光、声音、温度等,并将这些物理量转换为电信号,供树莓派读取和处理。 二、数…...
pytorch 指定GPU设备
使用os.environ["CUDA_VISIBLE_DEVICES"] 这种方法是通过环境变量限制可见的CUDA设备,从而在多个GPU的机器上只让PyTorch看到并使用指定的GPU。这种方式的好处是所有后续的CUDA调用都会使用这个GPU,并且代码中不需要显式地指定设备索引。 im…...
华为od-C卷200分题目6 - 5G 网络建设
华为od-C卷200分题目6 - 5G 网络建设 题目描述 现需要在某城市进行 5G 网络建设,已经选取 N 个地点设置 5G 基站,编号固定为 1 到 N,接下来需要各个基站之间使用光纤进行连接以确保基站能互联互通,不同基站之间架设光纤的成本各不…...

步进电机(STM32+28BYJ-48)
一、简介 步进电动机(stepping motor)把电脉冲信号变换成角位移以控制转子转动的执行机构。在自动控制装置中作为执行器。每输入一个脉冲信号,步进电动机前进一步,故又称脉冲电动机。步进电动机多用于数字式计算机的外部设备&…...

Node.js介绍 , 安装与使用
1.Node.js 1 什么是Node.js 官网:https://nodejs.org/zh-cn/ 中文学习网:http://nodejs.cn/learn1.Node.js 是一个基于 Chrome V8 引擎的 JavaScript 运行环境。Node.js 使用了一个事件驱动、非阻塞式 I/O 的模型,使其轻量又高效。 2.前端的底层 html…...

JavaEE初阶-网络原理1
文章目录 前言一、UDP报头二、UDP校验和2.1 CRC2.2 md5 前言 学习一个网络协议,最主要就是学习的报文格式,对于UDP来说,应用层数据到达UDP之后,会给应用层数据报前面加上UDP报头。 UDP数据报UDP包头载荷 一、UDP报头 如上图UDP的…...
leetcode秋招冲刺 (专题16--18)
专题16:分治 题目169:多数元素(YES) 解题思路:使用哈希表可以统计出现次数的性质,直接统计就行。 给定一个大小为 n 的数组 nums ,返回其中的多数元素。多数元素是指在数组中出现次数 大于 ⌊…...
学懂C#编程:实用方法——string字符串指定连接符拼接之 string.Join 的详细用法
在C#中,string.Join 方法用于将一个字符串数组或集合中的元素连接成一个单一的字符串,并在每个元素之间插入指定的分隔符。这个方法非常有用,特别是在需要将多个字符串合并成一个字符串时。以下是 string.Join 方法的详细用法: 方…...

Javascript常见数据结构和设计模式
在JavaScript中,常见的数据结构包括两大类:原始数据类型(Primitive Types)和对象类型(Object Types)。对象类型又可以进一步细分为多种内置对象、数组、函数等。下面是一些JavaScript中常见的数据结构&…...

Redis相关知识总结(缓存雪崩,缓存穿透,缓存击穿,Redis实现分布式锁,如何保持数据库和缓存一致)
文章目录 1.什么是Redis?2.为什么要使用redis作为mysql的缓存?3.什么是缓存雪崩、缓存穿透、缓存击穿?3.1缓存雪崩3.1.1 大量缓存同时过期3.1.2 Redis宕机 3.2 缓存击穿3.3 缓存穿透3.4 总结 4. 数据库和缓存如何保持一致性5. Redis实现分布式…...
Python爬虫实战:研究feedparser库相关技术
1. 引言 1.1 研究背景与意义 在当今信息爆炸的时代,互联网上存在着海量的信息资源。RSS(Really Simple Syndication)作为一种标准化的信息聚合技术,被广泛用于网站内容的发布和订阅。通过 RSS,用户可以方便地获取网站更新的内容,而无需频繁访问各个网站。 然而,互联网…...

MMaDA: Multimodal Large Diffusion Language Models
CODE : https://github.com/Gen-Verse/MMaDA Abstract 我们介绍了一种新型的多模态扩散基础模型MMaDA,它被设计用于在文本推理、多模态理解和文本到图像生成等不同领域实现卓越的性能。该方法的特点是三个关键创新:(i) MMaDA采用统一的扩散架构…...
基础测试工具使用经验
背景 vtune,perf, nsight system等基础测试工具,都是用过的,但是没有记录,都逐渐忘了。所以写这篇博客总结记录一下,只要以后发现新的用法,就记得来编辑补充一下 perf 比较基础的用法: 先改这…...

第 86 场周赛:矩阵中的幻方、钥匙和房间、将数组拆分成斐波那契序列、猜猜这个单词
Q1、[中等] 矩阵中的幻方 1、题目描述 3 x 3 的幻方是一个填充有 从 1 到 9 的不同数字的 3 x 3 矩阵,其中每行,每列以及两条对角线上的各数之和都相等。 给定一个由整数组成的row x col 的 grid,其中有多少个 3 3 的 “幻方” 子矩阵&am…...

【分享】推荐一些办公小工具
1、PDF 在线转换 https://smallpdf.com/cn/pdf-tools 推荐理由:大部分的转换软件需要收费,要么功能不齐全,而开会员又用不了几次浪费钱,借用别人的又不安全。 这个网站它不需要登录或下载安装。而且提供的免费功能就能满足日常…...

【C++特殊工具与技术】优化内存分配(一):C++中的内存分配
目录 一、C 内存的基本概念 1.1 内存的物理与逻辑结构 1.2 C 程序的内存区域划分 二、栈内存分配 2.1 栈内存的特点 2.2 栈内存分配示例 三、堆内存分配 3.1 new和delete操作符 4.2 内存泄漏与悬空指针问题 4.3 new和delete的重载 四、智能指针…...
django blank 与 null的区别
1.blank blank控制表单验证时是否允许字段为空 2.null null控制数据库层面是否为空 但是,要注意以下几点: Django的表单验证与null无关:null参数控制的是数据库层面字段是否可以为NULL,而blank参数控制的是Django表单验证时字…...

Scrapy-Redis分布式爬虫架构的可扩展性与容错性增强:基于微服务与容器化的解决方案
在大数据时代,海量数据的采集与处理成为企业和研究机构获取信息的关键环节。Scrapy-Redis作为一种经典的分布式爬虫架构,在处理大规模数据抓取任务时展现出强大的能力。然而,随着业务规模的不断扩大和数据抓取需求的日益复杂,传统…...

uniapp 小程序 学习(一)
利用Hbuilder 创建项目 运行到内置浏览器看效果 下载微信小程序 安装到Hbuilder 下载地址 :开发者工具默认安装 设置服务端口号 在Hbuilder中设置微信小程序 配置 找到运行设置,将微信开发者工具放入到Hbuilder中, 打开后出现 如下 bug 解…...