Centos7 安装部署 Python-3.6.1

13 篇文章 0 订阅

新安装的centos7中没有Python3环境 本来准备用yum安装的省时省力,发现yum默认的源里面Python3比较老,所以准备源码安装。
在官网下载包以后,编译安装,本来觉得应该很顺利,安装下来发现还是有些依赖库,为以后避免重复入坑,特此记录下。

环境:

$ uname -a
Linux bogon 3.10.0-514.26.2.el7.x86_64 #1 SMP Tue Jul 4 15:04:05 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux    
$ cat /etc/redhat-release 
CentOS Linux release 7.3.1611 (Core) 

首先下载最新版Python源码,执行:

wget https://www.python.org/ftp/python/3.6.1/Python-3.6.1.tar.xz
$ ./configure
$ make
$ sudo make install

make的时候报错:

zipimport.ZipImportError: can't decompress data; zlib not available
make: *** [install] Error 1

处理方式 安装zlib:

sudo yum install -y zlib*

继续编译安装完成,可以看到 pip 也一起安装了


但是在执行pip3 install 的时候报错:

sudo pip3 install beautifulsoup4
pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Collecting beautifulsoup4
  Could not fetch URL https://pypi.python.org/simple/beautifulsoup4/: There was a problem confirming the ssl certificate: Can't connect to HTTPS URL because the SSL module is not available. - skipping
  Could not find a version that satisfies the requirement beautifulsoup4 (from versions: )
No matching distribution found for beautifulsoup4
提示找不到ssl模块,查看openssl安装包,发现缺少openssl-devel包
$rpm -aq|grep openssl 


sudo yum install openssl

重新编译 Python-3.6.1.

再执行

$sudo pip3 install beautifulsoup4
[sudo] password for ***: 
Collecting beautifulsoup4
  Downloading beautifulsoup4-4.6.0-py3-none-any.whl (86kB)
    100% |████████████████████████████████| 92kB 220kB/s 
Installing collected packages: beautifulsoup4
Successfully installed beautifulsoup4-4.6.0

安装成功.

Done.

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值