关于python
Windows中python的安装
安装完成后,按下win+R ,输入cmd进入命令行
输入python --version可以查看是否安装(或者python -V)
输入python进入命令行后,可以输入quit()退出当前模式
Linux中python的安装
#输入以下文字安装python
[root@localhost ~]# yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel
可以提前准备python安装包
进入/opt目录
[root@localhost ~]# cd /opt
#将提前下好的python包拖入(可以去官网下),或者输入
[root@localhost opt]# wget http://npm.taobao.org/mirrors/python/3.9.0/Python-3.9.0.tgz
#如果没有wget命令,输入yum -y install wget,安装
安装python3
1.创建目录
[root@localhost opt]# mkdir -p /usr/local/python3
2.解压
[root@localhost opt]# tar -zxvf Python-3.9.0.tgz
3.安装gcc包
[root@localhost opt]# yum install gcc
4.安装libffi-devel包
[root@localhost opt]# yum install libffi-devel -y
5.[root@localhost opt]# cd Python-3.9.0/
6.[root@localhost Python-3.9.0]# ./configure --prefix=/usr/local/python3
7.编译
[root@localhost Python-3.9.0]# make
8.编译完成后安装
[root@localhost Python-3.9.0]# make install
9.检查
[root@localhost Python-3.9.0]# /usr/local/python3/bin/python3
10.[root@localhost Python-3.9.0]# vim /etc/profile
#复制以下内容
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/bin:/usr/local/python3/bin
export PATH
Esc,:wq 保存退出
[root@localhost Python-3.9.0]# source /etc/profile
12.验证
[root@localhost Python-3.9.0]# python3 -V
[root@localhost Python-3.9.0]# pip3 -V
[root@localhost Python-3.9.0]# python3
python安装完成