|
1.从Python官网下载源代码首先,你需要从Python的官方网站(https://www.python.org/downloads/source/)下载Python3.10的源代码。你可以使用wget命令从命令行下载,例如:wgethttps://www.python.org/ftp/python/3.10.x/Python-3.10.0.tgz1注意替换3.10.x为你想要的具体版本号。2.解压源代码包下载完成后,你需要将源代码包解压到一个目录中,例如/usr/local/。你可以使用tar命令来解压,例如:tar-xvfPython-3.10.0.tgz-C/usr/local/13.安装必要的依赖项在安装Python之前,你需要确保你的系统已经安装了所有必要的编译和构建工具以及Python依赖的库。这可以通过你的Linux发行版的包管理器来完成。例如,在基于Debian的系统(如Ubuntu)上,你可以使用apt命令来安装依赖项:sudoaptupdatesudoaptinstall-ybuild-essentialzlib1g-devlibncurses5-devlibgdbm-devlibnss3-devlibssl-devlibreadline-devlibffi-devlibsqlite3-devwgetlibbz2-dev12注意,具体的依赖项可能会因你的Linux发行版而有所不同。4.编译和安装Python进入解压后的Python源代码目录,并运行configure脚本来准备编译环境。你可以使用–prefix选项来指定Python的安装目录。然后,运行make命令来编译Python,最后使用makeinstall命令来安装Python。例如:cd/usr/local/Python-3.10.x./configure--prefix=/usr/local/python3.10makesudomakeinstall12345.验证安装安装完成后,你可以通过运行python3.10--version命令来验证Python3.10是否已成功安装并配置为系统的默认Python版本。如果一切正常,该命令将输出Python的版本号。注意:如果你的系统上已经安装了其他版本的Python,并且你想要使用Python3.10作为默认版本,你可能需要更新你的系统路径(PATH)以包括新安装的Python版本。这可以通过编辑你的shell配置文件(如.bashrc或.bash_profile)并添加类似exportPATH=/usr/local/python3.10/binPATH的行来完成。然后,你需要重新加载你的shell配置文件或重新登录以使更改生效。测试:/root目录下python3默认为3.11版本┌──(root㉿kali)-[~]└─#python3--versionPython3.11.412345切换安装目录/usr/local/Python-3.10.0切到安装目录/usr/local/Python-3.10.0下,python3显示版本为3.10,更新pip┌──(root㉿kali)-[/usr/local/Python-3.10.0]└─#python3--versionpip3--versionPython3.10.0pip21.2.3from/usr/local/python3.10/lib/python3.10/site-packages/pip(python3.10)┌──(root㉿kali)-[/usr/local/Python-3.10.0]└─#pip3.10install--upgradepipsetuptoolsRequirementalreadysatisfied:pipin/usr/local/python3.10/lib/python3.10/site-packages(21.2.3)CollectingpipDownloadingpip-24.0-py3-none-any.whl(2.1MB)|████████████████████████████████|2.1MB110kB/sRequirementalreadysatisfied:setuptoolsin/usr/local/python3.10/lib/python3.10/site-packages(57.4.0)CollectingsetuptoolsDownloadingsetuptools-69.5.1-py3-none-any.whl(894kB)|████████████████████████████████|894kB51kB/sInstallingcollectedpackages:setuptools,pipAttemptinguninstall:setuptoolsFoundexistinginstallation:setuptools57.4.0Uninstallingsetuptools-57.4.0:Successfullyuninstalledsetuptools-57.4.0Attemptinguninstall:pipFoundexistinginstallation:pip21.2.3Uninstallingpip-21.2.3:Successfullyuninstalledpip-21.2.3Successfullyinstalledpip-24.0setuptools-69.5.1WARNING:Runningpipasthe'root'usercanresultinbrokenpermissionsandconflictingbehaviourwiththesystempackagemanager.Itisrecommendedtouseavirtualenvironmentinstead:https://pip.pypa.io/warnings/venv┌──(root㉿kali)-[/usr/local/Python-3.10.0]└─#python3--versionpip3--versionPython3.10.0pip24.0from/usr/local/python3.10/lib/python3.10/site-packages/pip(python3.10)1234567891011121314151617181920212223242526272829303132333435运行代码┌──(root㉿kali)-[/usr/local/Python-3.10.0]└─#python3whereistheflag.pywhereismyflag:flag{7f9a2d3c-07de-11ef-be5e-cf1e88674c0b}whereistheflag[108,117,72,80,64,49,99,19,69,115,94,93,94,115,71,95,84,89,56,101,70,2,84,75,127,68,103,85,105,113,80,103,95,67,81,7,113,70,47,73,92,124,93,120,104,108,106,17,80,102,101,75,93,68,121,26]-----------------------------------------------------------------------[108,117,72,80,64,49,99,19,69,115,94,93,94,115,71,95,84,89,56,101,70,2,84,75,127,68,103,85,105,113,80,103,95,67,81,7,113,70,47,73,92,124,93,120,104,108,106,17,80,102,101,75,93,68,121,26]rrrrrrrrrrrright123456789
|
|