zoukankan      html  css  js  c++  java
  • 编译安装带ssl 模块指定版本Python

     
    出现这个或者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
    要在FedoraCentOS或者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
     
     
  • 相关阅读:
    实现控件的拖拽
    自定义控件——安卓旋转动画
    MD5简单实例
    TextView来实现跑马灯的效果
    Intent的简单使用
    SharedPreferences的封装
    ViewPager+fragment的使用
    安卓定时器
    2020重新出发,MySql基础,MySql视图&索引&存储过程&触发器
    2020重新出发,MySql基础,MySql表数据操作
  • 原文地址:https://www.cnblogs.com/stragon/p/5884205.html
Copyright © 2011-2022 走看看