window
1.1 下载地址:https://www.python.org/downloads/windows/ (windows版本)
图1-1-1
1.2 双击exe文件进行安装
如下图,并按照圈中区域进行设置,切记要勾选打钩的框,然后再点击Customize installation进入到下一步:
1.1 验证安装是否成功
WIN+R(快捷键)输入cmd打开命令行窗口,输入pyhton,显示如图1-3-1所示,说明安装成功。
Linux下安装
https://www.python.org/downloads/source/
[安装python依赖包]
yum -y install bzip2-devel libssl-dev libffi-devel python-devel libgsasl gcc cyrus-sasl-*
yum install bzip2-devel
yum -y install libssl-dev
yum -y install libffi-devel
yum -y install python-devel
yum -y install libgsasl
yum -y install gcc
yum -y install cyrus-sasl-*
[查看是否安装]
yum list installed bzip2-devel ,libssl-dev, libffi-devel,python-devel, libgsasl,gcc, cyrus-sasl-*
官网下载Python-3.5.6.tgz,上传至服务器下/usr/lib目录(需gcc编译环境)
(1) 解压文件
执行命令:tar -xvf Python-3.5.6.tgz
(2) 查看解压后文件
执行命令:ls
(3) 创建安装文件路径
执行命令:mkdir /usr/local/python3
(4) 进入解压目录
执行命令:cd /usr/lib/ Python-3.5.6
(5) 编译
执行命令:./configure --prefix=/usr/local/python3
(6) 安装
执行命令:make
执行命令:make install
(7) 查看安装是否成功
执行命令:ls /usr/local/python3/
执行命令:/usr/local/python3/bin/python3
若/usr/local/python3/目录下有4个目录,执行/usr/local/python3/bin/python3命令有
python3.5.6的字样说明安装成功
(8) 创建新版本的软连接
<1> 修改旧版本
执行命令:mv /usr/bin/python /usr/bin/python_bak
<2> 创建新的软连接
执行命令:ln -s /usr/local/python3/bin/python3 /usr/bin/python
<3> 检查python的版本
执行命令:python -V
(1) pip下载安装
wget https://files.pythonhosted.org/packages/ae/e8/2340d46ecadb1692a1e455f13f75e596d4eab3d11a57446f08259dee8f02/pip-10.0.1.tar.gz
tar xf pip-10.0.1.tar.gz
cd pip-10.0.1
python setup.py install #安装
ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3
yum -y install bzip2-devel ,zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel
tk-devel gdbm-devel db4-devel libpcap-devel xz-devel wget https://www.python.org/ftp/python/3.6.3/Python-3.6.3.tgz mkdir -p /usr/local/python3 tar -zxvf Python-3.6.3.tgz cd Python-3.6.3 ./configure --prefix=/usr/local/python3 make && make install ln -s /usr/local/python3/bin/python3 /usr/bin/python3 ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3