云网牛站
所在位置:首页 > Linux教程 > 在Debian 10系统上安装Python-3.9.2.tgz的方法

在Debian 10系统上安装Python-3.9.2.tgz的方法

2021-02-28 09:39:55作者:陈铜稿源:云网牛站

本文介绍在Debian 10系统上安装Python-3.9.2.tgz的方法,如果是安装Python 3.9.x版本,都可采用此方法。

在Debian 10系统上安装Python-3.9.2.tgz的方法

 

在Debian 10上安装Python 3.9.2

建议在Debian 10系统上安装Python 3.9.2之前,更新您的APT缓存索引:

sudo apt update

如果可以升级,请运行以下命令:

sudo apt upgrade -y

成功升级后,然后重新启动Debian 10系统:

sudo reboot

系统重新引导后,安装依赖项软件包:

sudo apt install wget software-properties-common build-essential libnss3-dev zlib1g-dev libgdbm-dev libncurses5-dev   libssl-dev libffi-dev libreadline-dev libsqlite3-dev libbz2-dev

按y键开始安装,输出的信息如下:

0 upgraded, 95 newly installed, 0 to remove and 0 not upgraded.

Need to get 74.7 MB of archives.

After this operation, 296 MB of additional disk space will be used.

Do you want to continue? [Y/n] y

访问Python下载页面并获取新版本,地址在https://www.python.org/downloads/,可在终端中下载,命令如下:

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

注:该版本的更新信息,请看Python 3.9.2与Python 3.8.8发布下载,附主要更新内容介绍

解压缩下载的文件:

tar xvf Python-3.9.2.tgz

更改工作目录以创建Python文件夹:

cd Python-3.9.2/

运行配置命令:

./configure --enable-optimizations

样本输出,如下:

checking for shm_open... yes

checking for shm_unlink... yes

checking for pkg-config... no

checking for openssl/ssl.h in /usr/local/ssl... no

checking for openssl/ssl.h in /usr/lib/ssl... no

checking for openssl/ssl.h in /usr/ssl... no

checking for openssl/ssl.h in /usr/pkg... no

checking for openssl/ssl.h in /usr/local... no

checking for openssl/ssl.h in /usr... no

checking whether compiling and linking against OpenSSL works... no

checking for --with-ssl-default-suites... python

checking for --with-builtin-hashlib-hashes... md5,sha1,sha256,sha512,sha3,blake2

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/ld_so_aix

config.status: creating pyconfig.h

config.status: pyconfig.h is unchanged

creating Modules/Setup.local

creating Makefile

在Debian 10 Linux上构建Python 3.9.2:

sudo make altinstall

成功的安装将具有类似于以下的输出内容:

changing mode of /usr/local/lib/python3.9/lib-dynload/__pycache__ to 755

running install_scripts

copying build/scripts-3.9/idle3.9 -> /usr/local/bin

copying build/scripts-3.9/pydoc3.9 -> /usr/local/bin

copying build/scripts-3.9/2to3-3.9 -> /usr/local/bin

changing mode of /usr/local/bin/idle3.9 to 755

changing mode of /usr/local/bin/pydoc3.9 to 755

changing mode of /usr/local/bin/2to3-3.9 to 755

rm /usr/local/lib/python3.9/lib-dynload/_sysconfigdata__linux_x86_64-linux-gnu.py

rm -r /usr/local/lib/python3.9/lib-dynload/__pycache__

/usr/bin/install -c -m 644 ./Misc/python.man \

 /usr/local/share/man/man1/python3.9.1

if test "xupgrade" != "xno"  ; then \

 case upgrade in \

 upgrade) ensurepip="--altinstall --upgrade" ;; \

 install|*) ensurepip="--altinstall" ;; \

 esac; \

 ./python -E -m ensurepip \

 $ensurepip --root=/ ; \

fi

Looking in links: /tmp/tmpog4qrruc

Requirement already up-to-date: setuptools in /usr/local/lib/python3.9/site-packages (49.2.1)

Requirement already up-to-date: pip in /usr/local/lib/python3.9/site-packages (20.2.3)

运行以下命令将输出系统中可用的Python 3.9.2版本:

$ python3.9 --version

Python 3.9.2

最后,如果要安装模块发行版页面中可用的Python模块,页面地址在https://pypi.org/,请使用以下命令语法:

python3.9 -m pip install <module>

至此,已成功在Debian 10 Linux系统上安装了Python-3.9.2.tgz,同时也检测出系统的确存在了Python 3.9.2版本。

 

相关主题

在Debian 10/Debian 9上安装Python & Django的步骤

精选文章
热门文章