出现这个或者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. android驱动开发前的准备(五)

    搭建S3C6410开发板的测试环境 首先安装串口调试工具 第一步:检测当前系统是否支持USB转串口 # lsmod | grep usbserial 第二步:安装minicom # apt-get i ...

  2. 关于for、foreach、filter等的一些用法

    通常我们使用得最熟悉的是for循环. 比如对于一组数字的排大小,可以使用冒泡法. var a=[];     for(var d=0;d<5;d++){         var b=window ...

  3. maven web 项目中启动报错java.lang.ClassNotFoundException: org.springframework.web.util.Log4jConfigListener

    环境:Groovy/Grails Tool Suite 3.1.0.RELEASE(BASED ON ECLIPSE JUNO 3.8.1).JDK1.6.Maven3.05.Tomcat6 错误描述 ...

  4. 【OPENGL】第二篇 HELLO OPENGL(续)

    上一次我们在这里分析了OpenGL的例子,但是最后还少分析最重要的部分:着色器相关的代码.因此这一次作为前一篇文章的续集. 上一篇文章的地址 http://www.cnblogs.com/MyGame ...

  5. AutoLearnSkills.lua --升级自动学习技能

    --[[作者信息: Auto Learn SKills (升级自动学习技能) 作者QQ:247321453 作者Email:247321453@qq.com 修改日期:2014-3-12 功能:在玩家 ...

  6. sql中的跨库查询

    在sql查询时,需要关联2个服务器上的不同数据库,只需要在所需查询的表名前加上服务器地址即可. 例如:在 192.168.0.15,8020的db110库 和 192.168.0.150,8082的d ...

  7. mouseover事件与mouseenter事件的区别

    不论鼠标指针穿过被选元素或其子元素,都会触发 mouseover 事件.对应mouseout 只有在鼠标指针穿过被选元素时,才会触发 mouseenter 事件.对应mouseleave 被触发的 M ...

  8. 转-springAOP基于XML配置文件方式

    springAOP基于XML配置文件方式 时间 2014-03-28 20:11:12  CSDN博客 原文  http://blog.csdn.net/yantingmei/article/deta ...

  9. golang调用c++的dll库文件

    最近使用golang调用c++的dll库文件,简单了解了一下,特作此笔记:一.DLL 的编制与具体的编程语言及编译器无关 dll分com的dll和动态dll,Com组件dll:不管是何种语言写的都可以 ...

  10. updatepanel 回发或回调参数无效

    不同于网上的其它情况,这个是由于通过js修改了服务器控件Select的列表项数目,导致验证viewstate时出现的问题.最后改为通过服务器代码来给Select加选项,就不会报这个错误了. 服务器控件 ...