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>

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

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM