python 前言
Python由荷兰数学和计算机科学研究学会的吉多·范罗苏姆于1990年代初设计,作为一门叫做ABC语言的替代品。 Python提供了高效的高级数据结构,还能简单有效地面向对象编程。Python语法和动态类型,以及解释型语言的本质,使它成为多数平台上写脚本和快速开发应用的编程语言,随着版本的不断更新和语言新功能的添加,逐渐被用于独立的、大型项目的开发。
download python
python | Python 编程语言的软件存储库 | 文档 |
download | download | 参考 |
Linux 各系统下载使用参考
Red Hat | Rocky Linux | Oracle Linux | AlmaLinux | ubuntu | suselinux | esxi | RHEL标准安装 | 系统安装参考 | YUM参考 | MobaXterm 远程连接工具 | Red Hat Enterprise 9.0 文档 | Kickstart 生成器 | |||||
download | download | download | download | download | download | download | 参考 | 参考 | 配置参考 | download | 参考 | Kickstart | |||||
版本兼容性 |
创建一键部署Python
- python 安装位置/opt/python
- 实现在线下载python,编译安装python,环境变量设置,插件下载安装,版本获取,删除安装包
vi /install_python.sh
#!/bin/bash
# -*- coding: utf-8 -*-
# Author: CIASM
# update 2023/05/17
directory=/root
python_directory_check=/opt/python
python_url=https://www.python.org/ftp/python/3.10.11/
python_tgz=Python-3.10.11.tgz
python_directory=Python-3.10.11
virtualenv_directory=virtualenv
virtualenv_url=https://files.pythonhosted.org/packages/d6/37/3ff25b2ad0d51cfd752dc68ee0ad4387f058a5ceba4d89b47ac478de3f59/virtualenv-20.23.0.tar.gz
setuptools_url=https://files.pythonhosted.org/packages/fd/53/e5d7ae40d03e4ed20b7cba317cf9c0c97097c8debb39f9d72d182a6578a2/setuptools-67.7.2.tar.gz
wheel_url=https://files.pythonhosted.org/packages/fc/ef/0335f7217dd1e8096a9e8383e1d472aa14717878ffe07c4772e68b6e8735/wheel-0.40.0.tar.gz
filelock_url=https://files.pythonhosted.org/packages/24/85/cf4df939cc0a037ebfe18353005e775916faec24dcdbc7a2f6539ad9d943/filelock-3.12.0.tar.gz
distlib_url=https://files.pythonhosted.org/packages/58/07/815476ae605bcc5f95c87a62b95e74a1bce0878bc7a3119bc2bf4178f175/distlib-0.3.6.tar.gz
platformdirs_url=https://files.pythonhosted.org/packages/9c/0e/ae9ef1049d4b5697e79250c4b2e72796e4152228e67733389868229c92bb/platformdirs-3.5.1.tar.gz
install_python (){
if [ ! -d ${python_directory_check} ];then
echo "install python"
if [ $? -eq 0 ];then
echo "Dependencies required to install Python"
yum install -y gcc openssl-devel bzip2-devel libffi-devel zlib-devel make cmake wget net-tools
echo "download Python"
wget -N -P $directory $python_url/$python_tgz
echo "make install Python"
tar -xf $directory/$python_tgz -C $directory
cd $directory/$python_directory && ./configure --prefix=$python_directory_check && make -j 4 && make install
echo "envionment variables Python"
echo 'export PATH=$PATH:/opt/python/bin' >> ~/.bashrc
source ~/.bashrc
echo "python environment variable soft linking"
ln -s $python_directory_check/bin/* /usr/bin/
echo "install Python virtualenv Dependent package"
mkdir -p /$virtualenv_directory
wget -N -P /$virtualenv_directory $virtualenv_url $setuptools_url $wheel_url $filelock_url $distlib_url $platformdirs_url
echo "virtualenv Dependent package"
pip3 install /$virtualenv_directory/*.tar.gz
virtualenv -p $python_directory_check/bin/python3 venv
source venv/bin/activate
echo "check Python version"
python3 --version | awk '{print $2}'
pip3 --version | awk '{print $2}'
virtualenv --version | awk '{print $2}'
wheel version | awk '{print $2}'
echo "Delete the downloaded installation package"
rm -rf $directory/Python*
rm -rf /$virtualenv_directory/*.tar.gz
#pip3 install virtualenv
#virtualenv -p $python_directory_check/bin/python3 venv
#source venv/bin/activate
echo -e "\033[32mThe python Install Sussess...\033[0m"
else
echo -e "\033[33mThe python Install Failed...\033[0m"
exit 1
fi
else
echo -e "\033[31mThe python Install already...\033[0m"
fi
}
main (){
install_python
}
main
执行安装
sh /install_python.sh