不知名的better 发布了3 篇原创文章 · 获赞 0 · 访问量 38 私信 关注源码安装
#安装依赖软件包 install_pkg(){ yum -y install gcc gcc-c++ zlib-devel bzip2-devel openssl-devel sqlite-devel readline-devel libffi-devel &>/dev/null } #下载软件包 download_pkg(){ cd /tmp wget https://www.python.org/ftp/python/3.7.6/Python-3.7.6.tar.xz &>/dev/null } #解压安装 tar_pkg(){ cd /tmp tar -xf Python-3.7.6.tar.xz &>/dev/null cd Python-3.7.6 } #修改文件 change_config(){ sed -ri 's/^#readline/readline/' Modules/Setup.dist sed -ri 's/^#(SSL=)/\1/' Modules/Setup.dist sed -ri 's/^#(_ssl)/\1/' Modules/Setup.dist sed -ri 's/^#([\t]*-DUSE)/\1/' Modules/Setup.dist sed -ri 's/^#([\t]*-L\$\(SSL\))/\1/' Modules/Setup.dist } #编译安装 make_makeinstall(){ cd /tmp/Python-3.7.6 ./configure --enable-shared &>/dev/null make && make install &>/tmp/python_.log } #配置共享库文件 lib_config(){ echo "# python3.7 共享库目录" >> /etc/profile.d/python3_lib.sh echo "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib" >> /etc/profile.d/python3_lib.sh echo "/usr/local/lib" >> /etc/ld.so.conf.d/python3.conf ldconfig source /etc/profile } main(){ install_pkg if [ $? -eq 0 ];then echo "依赖软件包安装完成" else break echo "依赖软件包安装失败,请检查网络" fi download_pkg if [ $? -eq 0 ];then echo "软件包下载完成" else break echo "软件包下载失败,请检查网络" fi tar_pkg if [ $? -eq 0 ];then echo "软件包解压完成" else break echo "软件包解压失败,请安装包是否存在" fi change_config &>/dev/null make_makeinstall if [ $? -eq 0 ];then echo "Python安装完成" else break echo "编译安装失败,请查看/tmp/python_.log" fi lib_config pip3 -V >/dev/null if [ $? -eq 0 ];then echo "pip3安装完成" else break echo "pip3安装失败," fi } main
相关文章
- 07-21Mac 10.12下安装python3环境
- 07-21debian下如何源码安装tmux
- 07-21Centos7下在windows和linux环境下安装达梦数据库
- 07-21macOS下软件包管理器-HomeBrew的国内脚本安装与更换国内镜像源
- 07-21windows环境下python3安装scrapy教程和安装注意事项
- 07-21CentOS7下的tftp安装
- 07-21Centos7下安装小米SQL优化工具SOAR
- 07-21superset在centos7下快速安装
- 07-21第一章 Centos7 下安装Jdk8u_131及配置环境变量
- 07-21centos7下docker的安装与卸载