最近使用到Sphinx编译文档,出现如下异常:

Extension error:
Could not import extension sphinx.builders.linkcheck (exception: cannot import name SSLError)

一开始有点摸不着头脑,明明是不能导入“sphinx.builders.linkcheck”,错误信息却是“cannot import name SSLError”

于是使用“-P”参数在异常时打开pdb调试,pdb打印信息如下:

Exception occurred while building, starting debugger:
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/Sphinx-1.5b1-py2.7.egg/sphinx/cmdline.py", line 295, in main
opts.warningiserror, opts.tags, opts.verbosity, opts.jobs)
File "/usr/local/lib/python2.7/dist-packages/Sphinx-1.5b1-py2.7.egg/sphinx/application.py", line 189, in __init__
self.setup_extension(extension)
File "/usr/local/lib/python2.7/dist-packages/Sphinx-1.5b1-py2.7.egg/sphinx/application.py", line 514, in setup_extension
err)
ExtensionError: Could not import extension sphinx.builders.linkcheck (exception: cannot import name SSLError)

可以看到出错的地方在“application.py”,于是打开该文件一探究竟,源码如下:

进一步在pdb打印“extension”和“err”

现在可以知道,是在import的时候遇到了importerror,但是不知道具体是哪里错了,干脆另起python命令行,直接import这个扩展“sphinx.builders.linkcheck”,结果出现如下错误:

可以看到错误原因是不能从“requests.packages.urllib3.exceptions”导入“SSLError”,经验证发现,可以在“requests.exceptions”里面导入“SSLError”

而网上搜索,大多也只是提到从“requests.exceptions”导入“SSLError”。由于Sphinx是刚下载的最新版,我怀疑可能是版本不兼容的问题。

查看requests版本发现requests确实不是最新版本(官网目前最新版本为:v2.12.1):

进一步上官网确认,发现官网上有关SSLError的代码确实已经发生变化:

到此,完全确认是requests版本更新过程中改变了“SSLError”的位置(导入方式),升级requests到最新版后问题解决。

debian下使用Sphinx异常“Could not import extension sphinx.builders.linkcheck (exception: cannot import name SSLError)”的解决的更多相关文章

  1. Debian下无root权限使用Python访问Oracle

    这篇文章的起因是,在公司的服务器上没有root权限,但是需要使用 Python 访问 Oracle,而不管是使用 pip 安装组件还是安装 Oracle 的 client,都需要相应权限.本文即解决该 ...

  2. debian下安装zendframework

    第一步,打开apache的rewrite模块,因为在debian下使用apache必须执行这一步 a2enmod rewrite #激活rewrite模块 /etc/init.d/apache2 re ...

  3. debian下使用gitosis+gitweb搭建SSH认证的git服务器

    搭建完成Git服务器后,需要使用两台机器进行测试,一台机器作为服务器端server,一台服务器作为客户端client.整个系统,需要三个计算机账户,这里假设server端的账户名为git,client ...

  4. atitit.js浏览器环境下的全局异常捕获

    atitit.js浏览器环境下的全局异常捕获 window.onerror = function(errorMessage, scriptURI, lineNumber) { var s= JSON. ...

  5. Debian下查看系统版本信息命令汇总

    Debian下如何查看版本信息, 包括位数.版本信息以及CPU内核信息.CPU具体型号等等,整个CPU信息一目了然. 1.odoo@debian64:~$ uname -a(Debian查看版本当前操 ...

  6. pycharm 4.5在debian下安装

    1.去官网下载linux下的Tar包,下载后解压. 2.直接进入解压后的folder里面找bin下面的pycharm.sh,执行后发现没有任何反应. 3.查询资料发现是因为pycharm需要sun j ...

  7. Debian下安装Firefox与flash简介

    Debian下安装Firefox与flash简介 由于Debian在Firefox的版权上出现了问题,导致官方发布的Debian系统不能使用默认的Firefox浏览器,最后官方重编的Firefox改名 ...

  8. debian下软件包管理方式总结

    linux最流行的包管理方式除了rpm之外就是debian的deb格式了.目前采用deb管理方式的主流操作系统主要有debian和ubuntu系列.和rpm包管理方式不同的是,虽然debian也有包含 ...

  9. Debian下自动备份文件并上传到远程FTP服务器且删除指定日期前的备份Shell脚本

    说明:  1.备份目录/home/osyunwei下面所有的文件到/home/osyunweibak里面,并且保存为osyunwei20120701.tar.gz的压缩文件格式(2012_07_01是 ...

随机推荐

  1. gradle

    http://examples.javacodegeeks.com/core-java/gradle/gradle-hello-world-tutorial/

  2. - >code vs 1475 m进制转十进制

    1475 m进制转十进制  时间限制: 1 s  空间限制: 128000 KB  题目等级 : 白银 Silver 题解  查看运行结果   题目描述 Description 将m进制数n转化成一个 ...

  3. HttpUtil

    1.发送doPost请求,在web那边使用request.setCharacterEncoding("UTF-8");保证中文不乱码,不需要第三方jar包 public stati ...

  4. Object-c 内存管理

                    内存管理 主要内容 1.内存管理的概念 2.引用计数 3.如何持有对象所有权 4.自动释放池 5.@property的使用 什么是内存管理 内存管理是关于如何管理对象生 ...

  5. JAVA程序中SQL语句无法传递中文参数

    vi /etc/my.cnf [mysqld]# The default character set that will be used when a new schema or table is# ...

  6. MapReduce工作原理图文详解

    目录:1.MapReduce作业运行流程2.Map.Reduce任务中Shuffle和排序的过程 1.MapReduce作业运行流程 流程示意图: 流程分析: 1.在客户端启动一个作业. 2.向Job ...

  7. python学习笔记(4)--函数

    1.函数 函数是指将一组语句的集合通过一个名字封装起来.要想执行这个函数,只需调用其函数名即可. 函数的特性: 1.减少重复代码 2.使程序变的课扩展 3.使程序变得易维护 语法定义: def pri ...

  8. WebStorm 2016.2 破解方法

    http://www.jetbrains.com/ 以前的 http://idea.lanyus.com/ 不能激活了 有帖子说的 http://15.idea.lanyus.com/ http:// ...

  9. 谈谈iOS中的屏幕方向

    众所周知,iOS中提供了[UIDevice currentDevice].orientation与[UIApplication sharedApplication].statusBarOrientat ...

  10. 学习微信小程序之css7

    盒模型 <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8 ...