ubuntu Python2 升级Python3

今天买了一台阿里的服务器, 想搭建一个爬虫, 但是 服务器是python2的, 需要升级到python3 

1. 下载python3的包

wget https://www.python.org/ftp/python/3.6.6/Python-3.6.6.tgz

2. 解压 

tar -zxvf Python-3.6.6.tgz

3.配置编译

./configure --prefix=/usr/local/python3 --with-ssl

4.安装

make && make install

5. 建立链接

ln -fs python3 python

 如果第4报错, 那去百度搜吧

我报的错是 

can't decompress data; zlib not available

说是 无法解压缩数据; zlib不可用

那么按转一下 zlib这个包

如果用下面的命令报 yum: command not found 那么需要安装yum       命令 apt-get install yum

yum -y install zlib zlib-devel 

 

香菇, 有报错了

There are no enabled repos.
 Run "yum repolist all" to see the repos you have.

 You can enable repos with yum-config-manager --enable <repo>

百度一下就解决了, 我这不想加了

 

posted @ 2019-06-25 09:27  开始战斗  阅读(1711)  评论(0编辑  收藏  举报