1、centos7默认支持的Python3版本为3.6,使用PyInstaller打包需要用到3.8的版本,需要使用scl来安装高版本的Python
SCL(Software Collections)可以让你在同一个操作系统上安装和使用多个版本的软件,而不会影响整个系统的安装包。SCL为社区的以下需求而设计:创建和使用软件集合生产系统、概念验证系统、开发测试平台。SCL目前已经支持Fedora和RHEL(衍生版本如CentOS也包含在内)。2、配置scl
yum -y install centos-release-scl-rh centos-release-scl3、安装Python3.8
yum install rh-python38
--设置环境变量
cat << EOF >/etc/profile.d/python38.sh
# create new
source /opt/rh/rh-python38/enable
export X_SCLS="`scl enable rh-python38 'echo $X_SCLS'`"
EOF
--source环境变量
source /etc/profile.d/python38.sh
--设置pip数据源
mkdir ~/.pip
cat << EOF > ~/.pip/pip.conf
[global]
index-url =http://mirrors.aliyun.com/pypi/simple/
[install]
trusted-host=mirrors.aliyun.com
[list]
format=columns
EOF
--安装配置PyInstaller
pip3 install redis
pip3.8 install wheel
pip3.8 install PyInstaller
--查看安装了哪些软件
[root@mysql1 ~]# pip3 list
Package Version
------------------------- -------
altgraph 0.17.3
async-timeout 4.0.2
pip 19.3.1
pyinstaller 5.11.0
pyinstaller-hooks-contrib 2023.3
redis 4.5.5
setuptools 67.8.0
wheel 0.40.0 4、PyInstaller打包软件
pyinstaller -w -F -n redis_health_check_rhel7_v1.5 -F redis_health_check_v1.5.py 「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。




