Rocky安装python3

DevOps Rocky评论3,927字数 1553阅读5分10秒阅读模式

下载

下载最新版本3.11

[root@i-sfg7loip ~]# cd /usr/local/src/
[root@i-sfg7loip src]# wget https://www.python.org/ftp/python/3.11.0/Python-3.11.0.tar.xz
--2022-11-02 20:07:48--  https://www.python.org/ftp/python/3.11.0/Python-3.11.0.tar.xz

解压

[root@i-sfg7loip src]# tar -xf Python-3.11.0.tar.xz

安装依赖

[root@i-sfg7loip src]#  yum install -y gcc
[root@i-sfg7loip src]# yum -y install zlib*
[root@i-sfg7loip Python-3.11.0]# yum install -y make

安装

编译

[root@i-sfg7loip src]# cd Python-3.11.0/
[root@i-sfg7loip Python-3.11.0]# ./configure --prefix=/usr/local/python3.11/
[root@i-sfg7loip Python-3.11.0]# echo $?
0
[root@i-sfg7loip Python-3.11.0]#  make && make install
Looking in links: /tmp/tmpyhfaf_xg
Processing /tmp/tmpyhfaf_xg/setuptools-65.5.0-py3-none-any.whl
Processing /tmp/tmpyhfaf_xg/pip-22.3-py3-none-any.whl
Installing collected packages: setuptools, pip
WARNING: The scripts pip3, pip3.10 and pip3.11 are installed in '/usr/local/python3.11/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-22.3 setuptools-65.5.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

配置变量

[root@i-sfg7loip Python-3.11.0]#  vim /etc/profile.d/python3.sh 
export PATH=$PATH:/usr/local/python3.11/bin

使其生效

[root@i-sfg7loip Python-3.11.0]# source /etc/profile
[root@i-sfg7loip Python-3.11.0]# python3.11
Python 3.11.0 (main, Nov  2 2022, 20:15:19) [GCC 8.5.0 20210514 (Red Hat 8.5.0-10)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>

 

继续阅读
DevOps
  • 本文由 发表于 2022年11月2日 20:17:45
  • 除非特殊声明,本站文章均为原创,转载请务必保留本文链接
  • python
评论  0  访客  0

发表评论