小编林家访*_*林家访的帖子

如何在python 2.7.6中导入_ssl?

我的http服务器基于BaseHTTPServer和Python 2.7.6.现在我希望它支持ssl传输,所谓的https.

我已经安装了pyOpenSSL并使用ssl支持重新编译了python源代码.当我尝试import ssl使用我的python解释器时,它确实有效,但是当我在服务器上运行代码时,它不起作用.错误日志是这样的:

import _ssl#如果我们无法导入它,让错误传播

看起来很奇怪,不是吗?我的操作系统是Debian Linux发行版.我已经尝试过各种各样的方法,我可以在互联网上找到几天,有谁可以帮助我摆脱这个麻烦?


我试图直接在服务器代码中"导入_ssl",但它提醒我:

>>>callstack
Traceback (most recent call last):
  File "./script/main.py", line 85, in process
    net_flag = net_api_process()
  File "./script/core/netbase/interface.py", line 96, in net_api_process
    flag1 = network.instance().process()
  File "./script/core/netbase/network.py", line 271, in process
    if network.process(max_events):
  File "./script/core/netbase/network.py", line 75, in on_incomin_stream
    self.on_package(buf)
  File "./script/core/netbase/network.py", line 78, in on_package
    self.f_on_package(self, buf)
  File "./script/client/behavior.py", line 68, in on_package
    handler.OnPackage(pack, cmd, conn.m_uid, conn)
  File "./script/client/handler.py", line 288, in OnPackage
    func(uid, conn, pack)
  File "./script/logic/user_info/modify.py", line …
Run Code Online (Sandbox Code Playgroud)

python ssl https httpserver

5
推荐指数
1
解决办法
1万
查看次数

标签 统计

https ×1

httpserver ×1

python ×1

ssl ×1