当前位置: 首页 > article >正文

centos7 安装python3.12.5

目录

1、安装openssl

1.1安装之前需要把本地openssl版本更新

1.2配置并编译安装

1.3安装后把本地的openssl备份一下

1.4添加环境变量

1.5刷新文件&&查看openssl版本

1.6配置新版的软连接

1.7 更新共享库的链接器缓存

2、安装Python3.12.5

2.1python3.12.5安装

2.2配置&&编译并安装

2.3配置环境变量

2.4测试python3 

 centos7安装python3.12.5,0报错安装 你们可能会有一些软件包依赖问题,可自行下载相关依赖包


1、安装openssl

1.1安装之前需要把本地openssl版本更新

openssl 下载地址

[root@ces-235 openssl-1.1.1w]# openssl version
OpenSSL 1.0.2k-fips  26 Jan 2017


[root@ces-235 ope]#  tar -xvf openssl-1.1.1w.tar.gz -C /usr/local/

[root@ces-235 ope]#  cd /usr/local/openssl-1.1.1w/

1.2配置并编译安装

[root@ces-235 openssl-1.1.1w]# ./config --prefix=/usr/local/openssl shared
Operating system: x86_64-whatever-linux2
Configuring OpenSSL version 1.1.1w (0x1010117fL) for linux-x86_64
Using os-specific seed configuration
Creating configdata.pm
Creating Makefile

**********************************************************************
***                                                                ***
***   OpenSSL has been successfully configured                     ***
***                                                                ***
***   If you encounter a problem while building, please open an    ***
***   issue on GitHub <https://github.com/openssl/openssl/issues>  ***
***   and include the output from the following command:           ***
***                                                                ***
***       perl configdata.pm --dump                                ***
***                                                                ***
***   (If you are new to OpenSSL, you might want to consult the    ***
***   'Troubleshooting' section in the INSTALL file first)         ***
***                                                                ***
**********************************************************************
[root@ces-235 openssl-1.1.1w]#  make && make install

1.3安装后把本地的openssl备份一下

[root@ces-235 openssl-1.1.1w]# mv /usr/bin/openssl /usr/bin/openssl.back 

1.4添加环境变量

vim /root/.bashrc 

export LD_LIBRARY_PATH=/usr/local/openssl/lib:$LD_LIBRARY_PATH

[root@ces-235 openssl-1.1.1w]# cat /root/.bashrc
# .bashrc

# User specific aliases and functions

alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'

# Source global definitions
if [ -f /etc/bashrc ]; then
        . /etc/bashrc
fi
export LD_LIBRARY_PATH=/usr/local/openssl/lib:$LD_LIBRARY_PATH

1.5刷新文件&&查看openssl版本

[root@ces-235 openssl-1.1.1w]# source /root/.bashrc
[root@ces-235 openssl-1.1.1w]# /usr/local/openssl/bin/openssl version
OpenSSL 1.1.1w  11 Sep 2023

1.6配置新版的软连接

[root@ces-235 openssl-1.1.1w]# ln -s /usr/local/openssl/bin/openssl /usr/bin/openssl
[root@ces-235 openssl-1.1.1w]# openssl version
OpenSSL 1.1.1w  11 Sep 2023

1.7 更新共享库的链接器缓存

[root@ces-235 openssl-1.1.1w]#  ldconfig
[root@ces-235 openssl-1.1.1w]#  openssl version
OpenSSL 1.1.1w  11 Sep 2023 

2、安装Python3.12.5

2.1python3.12.5安装

 python 下载地址

[root@ces-235 src]# tar -xvf Python-3.12.5.tgz -C /usr/local/

[root@ces-235 src]# cd /usr/local/Python-3.12.5/

2.2配置&&编译并安装

[root@ces-235 Python-3.12.5]# ./configure --prefix=/usr/local/python3.12 --with-openssl=/usr/local/openssl

[root@ces-235 Python-3.12.5]#  make && make install

最后有这样的安装完成提示

if test "x" != "x" ; then \
        rm -f /usr/local/python3.12/bin/python3-32; \
        (cd /usr/local/python3.12/bin; ln -s python3.12-32 python3-32) \
fi
if test "x" != "x" ; then \
        rm -f /usr/local/python3.12/bin/python3-intel64; \
        (cd /usr/local/python3.12/bin; ln -s python3.12-intel64 python3-intel64) \
fi
rm -f /usr/local/python3.12/share/man/man1/python3.1
(cd /usr/local/python3.12/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/tmpzke478ih
Processing /tmp/tmpzke478ih/pip-24.2-py3-none-any.whl
Installing collected packages: pip
  WARNING: The scripts pip3 and pip3.12 are installed in '/usr/local/python3.12/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.

2.3配置环境变量

export PATH="/usr/local/python3.12/bin:$PATH"

[root@ces-235 Python-3.12.5]# cat /root/.bashrc
# .bashrc

# User specific aliases and functions

alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'

# Source global definitions
if [ -f /etc/bashrc ]; then
        . /etc/bashrc
fi
export LD_LIBRARY_PATH=/usr/local/openssl/lib:$LD_LIBRARY_PATH
export PATH="/usr/local/python3.12/bin:$PATH"
[root@ces-235 Python-3.12.5]#
[root@ces-235 Python-3.12.5]# source /root/.bashrc

2.4测试python3 

[root@ces-235 Python-3.12.5]# pip3 install flask
Collecting flask
  Using cached flask-3.0.3-py3-none-any.whl.metadata (3.2 kB)
Collecting Werkzeug>=3.0.0 (from flask)
  Using cached werkzeug-3.0.4-py3-none-any.whl.metadata (3.7 kB)

Collecting Jinja2>=3.1.2 (from flask)
  Downloading jinja2-3.1.4-py3-none-any.whl.metadata (2.6 kB)
Collecting itsdangerous>=2.1.2 (from flask)
  Downloading itsdangerous-2.2.0-py3-none-any.whl.metadata (1.9 kB)
 

 centos7安装python3.12.5,0报错安装 你们可能会有一些软件包依赖问题,可自行下载相关依赖包




 


http://www.kler.cn/news/288967.html

相关文章:

  • 【链表】环形链表
  • Linux-centos7目录结构
  • C++入门基础知识45——【关于C++ 函数】定义函数、函数声明
  • 【网络安全】服务基础第一阶段——第六节:Windows系统管理基础---- DNS部署与安全
  • 【WPF动画】
  • kubeadm部署 Kubernetes(k8s) 高可用集群【V1.20 】
  • 智能创作与优化新时代:【ChatGPT-4o】在【数学建模】、【AI绘画】、【海报设计】与【论文优化】中的创新应用
  • 深度学习100问13:什么是二分类问题
  • 项目实战 ---- 商用落地视频搜索系统(5)---service层核心
  • Python进阶08-爬虫
  • 前端 数值列 禁止输入多个小数点
  • 按图搜索与精准营销:深度剖析拍立淘API用户画像构建
  • AlphaGo围棋模型——基于python语言
  • 交叉编译 gdb
  • HarmonyOS开发实战( Beta5版)优化实践/合理使用缓存提升性能
  • Linux 命令行快捷键
  • Netty Reactor面试连环问
  • 学习笔记 ---- 莫比乌斯反演总结
  • Spring Boot 入门
  • 5款手机版的影视解说文案生成器,无须下载更方便!
  • linux下cpu多核运行程序以及运行时间统计
  • 物联网(IoT)支持的小型水处理厂实时硬件在环(HIL)仿真
  • 角谷猜想——考拉兹猜想
  • 《OpenCV计算机视觉》—— 图像边缘检测
  • day4 C++
  • 【STM32】IIC
  • mongodb 在 Windows 环境下迁移数据库的问题
  • Linux:手搓shell
  • 解析淘宝商品详情API返回值中的特殊属性
  • python系列教程231——__init__.py