CentOS上安装配置Python3.8失败四次后安装成功记录

官网

目前最新版为3.8.3
https://www.python.org/downloads/release/python-383/

source code

下载 Python-3.8.3.tgz 然后传到服务器

py依赖

不先安装你在下一步的make好久之后就会报错zipimport.ZipImportError: can't decompress data; zlib not available make: *** [Makefile:1186: install] Error 1

[root@ecs tmp]# sudo yum install -y zlib-devel bzip2 bzip2-devel readline-devel sqlite sqlite-devel openssl-devel xz xz-devel libffi-devel

py

[root@ecs tmp]# ls
 Python-3.8.3.tgz    systemd-private-66c189fde94
[root@ecs tmp]# tar -zxvf Python-3.8.3.tgz
/*******15s*****/
[root@ecs tmp]# cd Python-3.8.3
[root@ecs tmp]# ./configure 
[root@ecs tmp]# ./configure --enable-optimizations
[root@ecs tmp]#  make&&make install
Installing collected packages: setuptools, pip
Successfully installed pip-19.2.3 setuptools-41.2.0
/*******/

配置环境变量

[root@ecs //]# ln -s /usr/local/bin/python3 /usr/bin/python
[root@ecs //]# ln -s /usr/local/bin/pip3 /usr/bin/pip
[root@ecs //]# python
Python 3.8.3 (default, Jun 21 2020, 22:49:23) 
[GCC 8.3.1 20190507 (Red Hat 8.3.1-4)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> quit()
[root@ecs tmp]# pip

Usage:   
  pip <command> [options]

yum

emm failed

[root@ecs ~]# yum install -y python38
Last metadata expiration check: 0:07:48 ago on Sun 21 Jun 2020 10:13:49 PM CST.
No match for argument: python38
Error: Unable to find a match: python38

[root@ecs ~]# yum install -y python36
Last metadata expiration check: 0:05:50 ago on Sun 21 Jun 2020 10:13:49 PM CST.
Package python36-3.6.8-2.module_el8.1.0+245+c39af44f.x86_64 is already installed.
Dependencies resolved.
Nothing to do.
Complete!
[root@ecs ~]# python
-bash: python: command not found

wget

[root@ecs ~]# wget https://www.python.org/ftp/python/3.8.3/Python-3.8.3.tgz
Python-3.8.3.tgz   3%[===>                                     ] 779.19K  4.31KB/s    eta 57m 5s 

参考

  • https://yq.aliyun.com/articles/640213
  • https://blog.csdn.net/qq_36288025/article/details/82534508
  • https://www.cnblogs.com/Jimc/p/10218062.html

你可能感兴趣的:(Centos)