pip提示找不到ssl模块

问题

CentOS 6.6, python 2.7.11
使用pip安装RobotFramework报错:

There was a problem confirming the ssl certificate: Can’t connect to HTTPS URL because the SSL module is not available.

解决方法

  1. 安装openssl、openssl-devel、pyOpenSSl包
    1
    2
    3
    yum install openssl
    yum install openssl-devel
    yum install pyOpenSSL
  1. 修改Python安装配置文件
    vim Python-2.7.11/Modules/Setup
    1
    2
    3
    4
    5
    6
    7
    8
    9
    # Socket module helper for socket(2)
    _socket socketmodule.c timemodule.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

去掉最后这三行的注释

  1. 重新编译Python安装
    make clean && make && make install
  2. 测试,正常可用
欢迎打赏!