ICode9

精准搜索请尝试: 精确搜索
首页 > 编程语言> 文章详细

Python2编译

2021-12-30 19:03:25  阅读:194  来源: 互联网

标签:socket ssl SSL 编译 include 安装 Python2


Python2编译

下载文件

直接去官网下载tar.gz的安装包即可,这里下载的是Python-2.7.18.tgz

编译

在root目录新建software文件夹,将压缩文件放进去,新建app目录用于存放编译后的文件

解压

tar -zxvf Python-2.7.18.tgz

安装到指定目录

进入到解压后的文件,安装到/root/app/python2

./configure --prefix=/root/app/python2/

增加ssl模块的支持

上面执行之后,会生成一个Modules文件夹,修改配置文件

vi Modules/Setup

找到ssl配置地方,将注释放开

# Socket module helper for socket(2)
#_socket socketmodule.c

# Socket module helper for SSL support; you must comment out the other
# socket line above, and possibly edit the SSL variable:
#SSL=/usr/local/ssl
#_ssl _ssl.c \
#       -DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \
#       -L$(SSL)/lib -lssl -lcrypto
改为
# Socket module helper for socket(2)
_socket socketmodule.c

# Socket module helper for SSL support; you must comment out the other
# socket line above, and possibly edit the SSL variable:
#SSL=/usr/local/ssl
_ssl _ssl.c \
        -DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \
        -L$(SSL)/lib -lssl -lcrypto

然后保存

编译安装

make && make install

错误

/usr/include/krb5.h:2606:24: et/com_err.h: No such file or directory

对于系统老的版本,可能会出现报错,需要安装e2fsprogs-devel

安装e2fsprogs-devel

yum install e2fsprogs-devel

再继续make && make install
编译成功之后,我们进入到/root/app/python2/bin目录下,会发现没有pip,因为默认python2是不自带的,需要安装

安装pip

./python -m ensurepip --default-pip

到此python的编译就成功了

标签:socket,ssl,SSL,编译,include,安装,Python2
来源: https://blog.csdn.net/fanxl10/article/details/122243272

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有