Kylin Server V10 下编译安装 Python

查看操作系统信息

[root@nacos1 ~]# cat /etc/.kyinfo 
[dist]
name=Kylin
milestone=Server-V10-GFB-Release-ZF9_01-2204-Build03
arch=arm64
beta=False
time=2023-01-09 11:04:36
dist_id=Kylin-Server-V10-GFB-Release-ZF9_01-2204-Build03-arm64-2023-01-09 11:04:36

[servicekey]
key=0080176

[os]
to=
term=2024-05-16
 

下载软件包

[root@localhost src]# wget https://www.python.org/ftp/python/3.13.0/Python-3.13.0.tar.xz
 

解压软件包

[root@localhost src]# tar -xvf Python-3.13.0.tar.xz
 

查看目录中的内容

[root@localhost src]# cd Python-3.13.0/
[root@localhost Python-3.13.0]# ls
aclocal.m4    config.status  Doc         InternalDocs  Mac              Misc     PC          pyconfig.h.in
Android       config.sub     Grammar     iOS           Makefile         Modules  PCbuild     Python
config.guess  configure      Include     Lib           Makefile.pre     Objects  Programs    README.rst
config.log    configure.ac   install-sh  LICENSE       Makefile.pre.in  Parser   pyconfig.h  Tools

编译

[root@localhost Python-3.13.0]# ./configure --prefix=/usr/local/Python3 --enable-optimizations

checking build system type... aarch64-unknown-linux-gnu
checking host system type... aarch64-unknown-linux-gnu
checking for Python interpreter freezing... ./_bootstrap_python
checking for python3.13... no
checking for python3.13... no
checking for python3.12... no
checking for python3.11... no
checking for python3.10... no
checking for python3... python3
checking Python for regen version... Python 3.7.4
checking for pkg-config... /bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking MACHDEP... "linux"
checking for --enable-universalsdk... no
checking for --with-universal-archs... no
checking for --with-app-store-compliance... not patching for app store compliance
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
....................................................................................
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
config.status: pyconfig.h is unchanged
configure: creating Modules/Setup.local
configure: creating Makefile

编译

[root@localhost Python-3.13.0]# make -j $(nporc)


./python -E -S -m sysconfig --generate-posix-vars ;\
if test $? -ne 0 ; then \
	echo "generate-posix-vars failed" ; \
	rm -f ./pybuilddir.txt ; \
	exit 1 ; \
fi
./python -E -c 'import sys ; from sysconfig import get_platform ; print("%s-%d.%d" % (get_platform(), *sys.version_info[:2]))' >platform
The necessary bits to build these optional modules were not found:
_dbm                      _gdbm                     _tkinter               
To find the necessary bits, look in configure.ac and config.log.

Checked 112 modules (33 built-in, 75 shared, 1 n/a on linux-aarch64, 0 disabled, 3 missing, 0 failed on import)
make[1]: 离开目录“/usr/local/src/Python-3.13.0”

安装

[root@localhost Python-3.13.0]# make install
 

Creating directory /usr/local/Python3/share/man
Creating directory /usr/local/Python3/share/man/man1
/bin/install -c -m 644 ./Misc/python.man \
	/usr/local/Python3/share/man/man1/python3.13.1
if test ! -d /usr/local/Python3/lib/pkgconfig; then \
	echo "Creating directory /usr/local/Python3/lib/pkgconfig"; \
	/bin/install -c -d -m 755 /usr/local/Python3/lib/pkgconfig; \
fi
if test -f /usr/local/Python3/bin/python3 -o -h /usr/local/Python3/bin/python3; \
then rm -f /usr/local/Python3/bin/python3; \
else true; \
fi
(cd /usr/local/Python3/bin; ln -s python3.13 python3)
if test "3.13" != "3.13"; then \
	rm -f /usr/local/Python3/bin/python3.13-config; \
	(cd /usr/local/Python3/bin; ln -s python3.13-config python3.13-config); \
	rm -f /usr/local/Python3/lib/pkgconfig/python-3.13.pc; \
	(cd /usr/local/Python3/lib/pkgconfig; ln -s python-3.13.pc python-3.13.pc); \
	rm -f /usr/local/Python3/lib/pkgconfig/python-3.13-embed.pc; \
	(cd /usr/local/Python3/lib/pkgconfig; ln -s python-3.13-embed.pc python-3.13-embed.pc); \
fi
rm -f /usr/local/Python3/bin/python3-config
(cd /usr/local/Python3/bin; ln -s python3.13-config python3-config)
rm -f /usr/local/Python3/lib/pkgconfig/python3.pc
(cd /usr/local/Python3/lib/pkgconfig; ln -s python-3.13.pc python3.pc)
rm -f /usr/local/Python3/lib/pkgconfig/python3-embed.pc
(cd /usr/local/Python3/lib/pkgconfig; ln -s python-3.13-embed.pc python3-embed.pc)
rm -f /usr/local/Python3/bin/idle3
(cd /usr/local/Python3/bin; ln -s idle3.13 idle3)
rm -f /usr/local/Python3/bin/pydoc3
(cd /usr/local/Python3/bin; ln -s pydoc3.13 pydoc3)
if test "x" != "x" ; then \
	rm -f /usr/local/Python3/bin/python3-32; \
	(cd /usr/local/Python3/bin; ln -s python3.13-32 python3-32) \
fi
if test "x" != "x" ; then \
	rm -f /usr/local/Python3/bin/python3-intel64; \
	(cd /usr/local/Python3/bin; ln -s python3.13-intel64 python3-intel64) \
fi
rm -f /usr/local/Python3/share/man/man1/python3.1
(cd /usr/local/Python3/share/man/man1; ln -s python3.13.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/tmph1nw2jms
Processing /tmp/tmph1nw2jms/pip-24.2-py3-none-any.whl
Installing collected packages: pip
  WARNING: The scripts pip3 and pip3.13 are installed in '/usr/local/Python3/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed pip-24.2
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager, possibly rendering your system unusable.It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv. Use the --root-user-action option if you know what you are doing and want to suppress this warning.

查看Python版本号

[root@localhost ~]# python3 --version

Python 3.13.0

查看pip3版本号

[root@localhost ~]# pip3 --version

pip 24.2 from /usr/local/Python3/lib/python3.13/site-packages/pip (python 3.13)
 

猜你喜欢

转载自blog.csdn.net/canglonghacker/article/details/143373363