一:在windows下装置python

1:登录python官网下载安装包

https://www.python.org/downlo...

2:装置python

将下载下来的python安装包失常装置即可,只须要留神:记得勾选 Add Python 3.8 to PATH。这里是让他装置的时候主动帮你增加环境变量,省得还要去本人增加环境变量
装置后,如果你没有勾选Add Python 3.8 to PATH的话须要本人增加环境变量右击计算机->属性->高级零碎设置->环境变量->批改零碎变量path,增加Python装置地址

3:判断python是否装置胜利

在命令行输出python --version呈现如下景象阐明装置胜利

二:在linux下装置python

1:下载python

关上WEB浏览器拜访 https://www.python.org/downlo...将实用于 Linux 的源码压缩包下载下来。

2:装置python

tar -zxvf Python-3.6.4.tgzcd Python-3.6.4./configure --with-sslmake && make install

如果显示没有装置胜利可能是没有设置环境变量

export PATH="$PATH:/usr/local/bin/python" ,按下"Enter"。
留神:
  1. 在执行./configure时可能会报以下谬误:
checking build system type... x86_64-pc-linux-gnuchecking host system type... x86_64-pc-linux-gnuchecking for python3.6... nochecking for python3... nochecking for python... pythonchecking for --enable-universalsdk... nochecking for --with-universal-archs... nochecking MACHDEP... linuxchecking for --without-gcc... nochecking for --with-icc... nochecking for gcc... nochecking for cc... nochecking for cl.exe... noconfigure: error: in `/root/Python-3.6.4':configure: error: no acceptable C compiler found in $PATHSee `config.log' for more details

解决办法:

  • 先装置GCC软件套件
yum install gcc
  • 从新编译
./configure --with-ssl
  1. 在执行make install时报错:
zipimport.ZipImportError: can't decompress data; zlib not available make

解决办法:

  • 装置zlib相干依赖包
yum -y install zlib*
  • 从新执行装置
make && make install
  1. 装置实现之后应用pip3去装置python3插件报错:
pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.

解决办法:

  • 查看openssl安装包
 rpm -aq|grep openssl

查看是否短少openssl-devel包,

  • 装置openssl-devel
yum install openssl-devel -y
  • 对python3进行从新编译
cd Python-3.6.4./configure --with-sslmakesudo make install
  • pip3降级:
pip3 install --upgrade pip

3:判断python是否装置胜利

# python3 -VPython 3.8.6