python安装
配置yum源
//配置yum源
[root@localhost ~]# rpm -ivh http://mirror.centos.org/centos/7/os/x86_64/Packages/wget-1.14-18.el7.x86_64.rpm
[root@localhost ~]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# wget http://mirrors.163.com/.help/CentOS7-Base-163.repo
[root@localhost ~]# sed -i 's/\$releasever/7/g' /etc/yum.repos.d/CentOS7-Base-163.repo
[root@localhost ~]# sed -i 's/^enabled=.*/enabled=1/g' /etc/yum.repos.d/CentOS7-Base-163.repo
[root@localhost src]# yum clean all
[root@localhost ~]# yum -y install epel-release
Python编译安装
//下载Python程序源码包
[root@localhost ~]# cd /usr/src
[root@localhost ~]# wget https://www.python.org/ftp/python/3.7.3/Python-3.7.3.tar.xz
[root@localhost src]# ls
debug kernels Python-3.7.3.tar.xz
//安装编译器与依赖包
[root@localhost src]# yum -y install gcc gcc-c++ make zlib-devel libffi-devel openssl openssl-devel bzip2 bzip2-devel vim readline-devel ncurses-devel sqlite-devel gdbm-devel xz-devel tk-devel
//编译安装
[root@localhost src]# tar xf Python-3.7.3.tar.xz
[root@localhost src]# cd Python-3.7.3
[root@localhost Python-3.7.3]# ls
aclocal.m4 configure Include m4 Modules PCbuild README.rst
CODE_OF_CONDUCT.rst configure.ac install-sh Mac Objects Programs setup.py
config.guess Doc Lib Makefile.pre.in Parser pyconfig.h.in Tools
config.sub Grammar LICENSE Misc PC Python
[root@localhost Python-3.7.3]# ./configure --prefix=/usr/local/python37
[root@localhost Python-3.7.3]# make
[root@localhost Python-3.7.3]# make install
//安装后配置
[root@localhost ~]# ls /usr/local/python37/
bin include lib share
[root@localhost ~]# echo 'export PATH=/usr/local/python37/bin:$PATH' > /etc/profile.d/py3.sh
[root@localhost ~]# source /etc/profile.d/py3.sh
[root@localhost ~]# echo $PATH
/usr/local/python37/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
[root@localhost ~]# which python3
/usr/local/python37/bin/python3
[root@localhost ~]# pip3.7 install --upgrade pip
PyCharm安装
PyCharm管网上下载 https://www.jetbrains.com/pycharm/download/#section=windows
下载选择Community社区版下载就行
下载完后双击安装
如果电脑没有Python的解释器,需要安装一个解释器