1.    ModuleNotFoundError: No module named 'cookielib'

Python3中,import  cookielib改成 import  http.cookiejar,然后方法里cookielib也改成 http.cookiejar。

2.    ModuleNotFoundError: No module named 'urllib2'

Python 3中urllib2用urllib.request替代。

在Python官方文档里面已有说明:

Note:

The urllib2 module has been split across several modules in Python 3.0 named urllib.request and urllib.error. The 2to3 tool will automatically adapt imports when converting your sources to 3.0.

from urllib.request import urlopen

response = urlopen("http://www.google.com")

html = response.read()

print(html)

3.    NameError: name 'raw_input' is not defined

Python 3中用input()替换raw_input()

4.    UserWarning: You provided Unicode markup but also provided a value for from_encoding. Your from_encoding will be ignored.

注意这句:warnings.warn("You provided Unicode markup but also provided a value for from_encoding. Your from_encoding will be ignored.") 原因:python3 缺省的编码是unicode, 再在from_encoding设置为utf8, 会被忽视。

Python 3中soup = BeautifulSoup(html_doc, "html.parser", from_encoding="utf-8")这一句中删除from_encoding="utf-8"

------------------------------------------------------Tanwheey-------------------------------------------------------------------------

爱生活,爱工作。

python 3.x报错:No module named 'cookielib'或No module named 'urllib2'的更多相关文章

  1. [转]happybase1.0 报错:ThriftPy does not support generating module with path in protocol 'f'

    happybase1.0 报错:ThriftPy does not support generating module with path in protocol 'f' 2016-10-12 14: ...

  2. vue解决启动报错cjs loader.js Error: Cannot find module '../config'问题

    vue解决启动报错cjs loader.js Error: Cannot find module '../config'问题 今天下载了一个开源项目一直运行不了,折腾了半天才找到问题所在,config ...

  3. 【python】python读取文件报错UnicodeDecodeError: 'gbk' codec can't decode byte 0xac in position 2: illegal multibyte sequence

    python读取文件报错UnicodeDecodeError: 'gbk' codec can't decode byte 0xac in position 2: illegal multibyte ...

  4. 【python】python安装tensorflow报错:python No matching distribution found for tensorflow==1.12.0

    python安装tensorflow报错:python No matching distribution found for tensorflow==1.12.0 python版本是3.7.2 要安装 ...

  5. mac下python环境pip报错[SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:590) 的解决方法

    1.mac下python环境pip报错: issuserdeMacBook-Pro:~ issuser$ pip install pyinstallerCollecting pyinstaller  ...

  6. Django中修改DATABASES后,执行python manage.py ****报错!UnicodeEncodeError

    Django中修改DATABASES后,执行python manage.py ****报错!UnicodeEncodeError: 'latin-1' codec can't encode chara ...

  7. python 安装模块报错 response.py", line 302, in _error_catcher

    python 安装模块报错 Exception:Traceback (most recent call last): File "/usr/share/python-wheels/urlli ...

  8. 【原创】大叔经验分享(11)python引入模块报错ImportError: No module named pandas numpy

    python应用通常需要一些库,比如numpy.pandas等,安装也很简单,直接通过pip # pip install numpyRequirement already satisfied: num ...

  9. python导入模块报错:ImportError: No module named mysql.connector(安装 mysql)

    python的版本是 $ python --version Python 2.7.12 报错代码如下 import mysql.connector 报错信息是 ImportError: No modu ...

随机推荐

  1. BZOJ3875--骑士游戏(SPFA处理带后效性的动态规划)

    3875: [Ahoi2014]骑士游戏 Time Limit: 30 Sec  Memory Limit: 256 MBSubmit: 181  Solved: 91[Submit][Status] ...

  2. [CSP-S模拟测试]:笨小猴(随机化)

    题目传送门(内部题118) 输入格式 输入第一行是一个整数$n$,意义如以上所示. 接下来有$2n+1$行,每行为两个正整数,第$i$行的两个正整数分别代表$A_i$和$B_i$. 输出格式 如果无法 ...

  3. Redis Cluster with SpringBoot

    前提: 按照 https://www.cnblogs.com/luffystory/p/12081074.html 配置好Redis Cluster in Ubuntu 按照如下结构搭建项目结构: P ...

  4. Zookeeper入门(五)之Linux环境下Zookeeper安装

    本文参考地址为:http://www.mamicode.com/info-detail-2243059.html1.安装wget http://archive.apache.org/dist/zook ...

  5. 使用oracle删除表中重复记录

    (1)使用用rowid方法 查询重复数据:select * from person a where rowid !=(select max(rowid) from person b where a.c ...

  6. kotlin 简单处理 回调参数 加?

    Kotlin Parameter specified as non-null is null 2017年10月18日 17:21:49 amiko_ 阅读数:9017    版权声明:本文为博主原创文 ...

  7. 【Spark机器学习速成宝典】模型篇04朴素贝叶斯【Naive Bayes】(Python版)

    目录 朴素贝叶斯原理 朴素贝叶斯代码(Spark Python) 朴素贝叶斯原理 详见博文:http://www.cnblogs.com/itmorn/p/7905975.html 返回目录 朴素贝叶 ...

  8. C++二维数组名的再探索

    #include <iostream> int main() { ][] = { , , , , , , , , , , , }; //输出 0,1,2,3,4,5,6,7,8,9,10, ...

  9. 网页页头meta详解(科普知识)

    1.Content-Type和Content-Language (显示字符集的设定)  说明:设定页面使用的字符集,用以说明主页制作所使用的文字已经语言,浏览器会根据此来调用相应的字符集显示page内 ...

  10. Molecular Dynamics

    First]前处理 Second]运行MD Third]后处理 一.获得结构文件-来自实验数据或者某些化学软件工具 1]第一步: 获取并处理pdb文件 从Protein Data Bank下载小肽的p ...