出现这个或者fatal error: openssl/名单.h: No such file or directory。都是没有安装libssl-dev~
libssl-dev包含libraries, header files and manpages,他是openssl的一部分,而openssl对ssl进行了实现~
解决方案:
要在Debian、Ubuntu或者其他衍生版上安装OpenSSL:
  1. $ sudo apt-get install libssl-dev
要在Fedora、CentOS或者RHEL上安装OpenSSL开发包:
  1. $ sudo yum install openssl-devel
https://www.python.org/ftp/python/2.7.11/Python-2.7.11.tar.xz wget 下载指定安装包解压缩,
tar -xvf Python-2.7.tar.bz2
cd Python-2.7
修改python setup 配置,开启ssl模块:
因为编译 python 的时候没有把 ssl模块 编译进去,只需修改 Modules/Setup文件 重新编译安装即可。
进入python安装包,找到Setup文件,用 vi 打开
  1. cd Python-2.7.11/Modules
  1. vi Setup.dist
找到
  1. # Socket module helper for SSL support; you must comment out the other
  1. # socket line above, and possibly edit the SSL variable:
  1. #SSL=/usr/local/ssl#_ssl _ssl.c \
  1. #       -DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \
  1. #       -L$(SSL)/lib -lssl -lcrypto
把前面的 # 号去掉,修改为
  1. # Socket module helper for SSL support; you must comment out the other
  1. # socket line above, and possibly edit the SSL variable:
  1. SSL=/usr/local/ssl
  1. _ssl _ssl.c \
  1. -DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \       -L$(SSL)/lib -lssl -lcrypto
保存退出,重新编译安装(注意:
安装python之前,最好确认一下gcc是否安装。apt-get install -y gcc
如果提示make:command not found则用apt-get -y install gcc automake autoconf libtool make先安装编译器
否则./configure 阶段就会报错了)
  1. ./configure --enable-shared       #这里一定要注意,解压完之后要设置enable-shared参数, 在wsgi.py 在web server中python 才能在apache或者Nginx运行
  1. make && make install
 
  1. sudo apt-get install sqlite
  1. sudo apt-get install libsqlite3-dev
  1. 如果安装django如果错误的最后一行是
  1. django.core.exceptions.ImproperlyConfigured: Error loading either pysqlite2 or sqlite3 modules (tried in that order): No module named _sqlite3
  1. 则可以试一下命令
 
 
  1. tar -xzf pysqlite-2.6.3.tar.gz
  1. cd pysqlite
  1. python setup.py install
 
 
 
  1. sudo apt-get install openssl
  1. sudo apt-get install libssl-dev
  1. RedHat、centos才是openssl-devel
完成如果遇到错误:
 
python: error while loading shared  libraries: libpython2.7.so.1.0: 
  cannot open shared object file: No such file or
   
解决方案: 
新建下面文件
  vim /etc/ld.so.conf.d/python2.7.conf
  加入内容:
  /usr/local/lib
  保存退出后运行:
  ldconfig
 
 

编译安装带ssl 模块指定版本Python的更多相关文章

  1. Ubuntu环境下非root用户指定版本Python的安装及虚拟环境virtualenv的使用

    Ubuntu环境下非root用户指定版本Python的安装及虚拟环境virtualenv的使用 参考博客: https://blog.csdn.net/leviopku/article/details ...

  2. 编译安装HTTPD 2.4.9版本

    编译安装HTTPD 2.4.9版本    服务脚本:/etc/rc.d/init.d/httpd    脚本配置文件路径:/etc/sysconfig/httpd    运行目录:/etc/httpd ...

  3. Ubuntu16.04下编译安装OpenCV3.4.0(C++ & python)

    Ubuntu16.04下编译安装OpenCV3.4.0(C++ & python) 前提是已经安装了python2,python3 1)安装各种依赖库 sudo apt-get update ...

  4. 【01】Nginx:编译安装/动态添加模块

    写在前面的话 说起 Nginx,别说运维,就是很多开发人员也很熟悉,毕竟如今已经 2019 年了,Apache 更多的要么成为了历史,要么成为了历史残留. 我们在提及 Nginx 的时候,一直在强调他 ...

  5. CentOS7 编译安装python3.6.8(升级python)

    1.安装依赖包和需要用到的工具 yum -y install wget openssl openssl-devel 这里如果不升级openssl,安装后pip安装模块可能会出错.点我查看pip安装模块 ...

  6. 运维笔记--Docker环境ubuntu系统安装指定版本python[3.6]

    场景描述: 直接安装出现如下异常: root@ae2d02e458f3:/home# apt-get install python3.6 Reading package lists... Done B ...

  7. zstack源码编译安装(1.7.x版本)

    图片没粘贴过来,请看本人gitbook吧https://www.gitbook.com/book/jingtyu/how-to-learn-zstack-code 运行环境 zstack的安装方式有很 ...

  8. 编译安装带lua 的 vim 编辑器

    注:支持7.4以后的vim版本 安装lua dev库yum -bcurrent install lua-devel 编译vim带lua支持,安装到/home/sy120714/software/vim ...

  9. Nginx 最新版源码编译安装 包含常用模块作用及所需依赖

    第一部分 Nginx最新版源码编译安装 1. 使用的模块 模块1:http_rewrite_module 基于正则匹配来实现重定向.依赖PCRE库,见依赖1 模块2:http_gzip_module ...

随机推荐

  1. Linux下高cpu解决方案(转载)

    昨天搞定了一个十万火急的issue,客户抱怨产品升级后系统会变慢和CPU使用率相当高,客户脾气很大,声称不尽快解决这个问题就退货,弄得我们 R&D压力很大,解决这个issue的任务分给了我,客 ...

  2. java疑问-继承问题

    存在两个类,B 继承 A,C 继承 B,我们能将 B 转换为 C 么?如 C = (C) B:

  3. 1.5 linux笔记

    fdisk /dev/sda   查看sda下硬盘状态 fdisk l 看LIST所有文件系统 fdisk n 创建分区 fdisk m help fdisk p 查看所有分区 fdisk w 保存分 ...

  4. Enterprise Library 6

    Enterprise Library 6 正式版 MSDN:http://msdn.microsoft.com/en-gb/library/dn169621.aspx 源码下载:http://entl ...

  5. Dubbo 与 ImmutableList冲突解决

    在Java web实际开发中,常常用到微服务来进行架构分离,今天遇到一特奇怪的问题,Dububo 调用了接口三次,provider端而且没有抛出Exception.consumer却端抛出调用失败的异 ...

  6. 利用web工具splinter模拟登陆做自动签到

    首先,我需要的工具和组件有: Chrome浏览器 浏览器驱动ChromeDriver Python 3.5 Web应用测试工具Splinter 代码部分: from splinter import B ...

  7. JAVA之Forward 和 Redirect的区别

    1.从地址栏显示来说forward是服务器请求资源,服务器直接访问目标地址的URL,把那个URL的响应内容读取过来,然后把这些内容再发给浏览器.浏览器根本不知道服务器发送的内容从哪里来的,所以它的地址 ...

  8. 使用keytool 生成证书

    keytool 工具介绍 keytool 是java 用于管理密钥和证书的工具,其功能包括: 1 创建并管理密钥 2 创建并管理证书 3 作为CA 为证书授权 4 导入导出证书 keytool 采用k ...

  9. java获得某个月的天数

    /*** 方法一*/ String strDate = "2012-02"; SimpleDateFormat format = new SimpleDateFormat(&quo ...

  10. Beta版本冲刺——day7

    No Bug 031402401鲍亮 031402402曹鑫杰 031402403常松 031402412林淋 031402418汪培侨 031402426许秋鑫 站立式会议 今日计划表 人员 工作 ...