目录

11.name 'reload' is not defined

12.ModuleNotFoundError: No module named 'requests'

13.ImportError: cannot import name 'izip' from 'itertools' (unknown location)

14.ModuleNotFoundError: No module named 'urllib2'

15.ModuleNotFoundError: No module named 'urlparse'

16.NameError: name 'basestring' is not defined

17.ModuleNotFoundError: No module named 'commands'

18.ModuleNotFoundError: No module named 'auth'

19.ModuleNotFoundError: No module named 'psycopg2'

20.ModuleNotFoundError: No module named 'pycurl'

21. 接20;下载完pycurl后运行报

ImportError: pycurl: libcurl link-time ssl backend (nss) is different from compile-time ssl backend (none/other)

11.name 'reload' is not defined

解决:

重新加载sys模块,并设置默认编码utf-8  

import importlib

importlib.reload(sys)

12.ModuleNotFoundError: No module named 'requests'

解决:

pip3 install requests

13.ImportError: cannot import name 'izip' from 'itertools' (unknown location)

解决:

Python3替换izip模块

try:

  from itertools import izip

except ImportError:

  izip = zip

14.ModuleNotFoundError: No module named 'urllib2'

解决:

目前使用该模块的是Python3版本,而urllib2在3版本中不再适用,需导入urllib.request模块

删除import urllib2

换为import urllib.request

15.ModuleNotFoundError: No module named 'urlparse'

解决:

python3版本中已经将urllib2、urlparse、和robotparser并入了urllib模块中

import urlparse 改为 from urllib import parse

16.NameError: name 'basestring' is not defined

解决:

try:

basestring

except NameError:

basestring = str

替换为str

17.ModuleNotFoundError: No module named 'commands'

解决:

python3中commands已经不存在了

替换为subprocess

18.ModuleNotFoundError: No module named 'auth'

解决:

pip3 install auth

19.ModuleNotFoundError: No module named 'psycopg2'

解决:

将psycopg2的版本升至2.7.6

pip3 install psycopg2==2.7.6

20.ModuleNotFoundError: No module named 'pycurl'

解决:

pip3 install pucurl

报错:

main.ConfigurationError: Could not run curl-config: [Errno 2] No such file or directory: 'curl-config': 'curl-config'

系统已经安装了curl,出现此错误提示一般是因为没有安装对应的开发库,解决方法:

解决:

yum -y install libcurl-devel

后再pip3 install pycurl

21. 接20;下载完pycurl后运行报

ImportError: pycurl: libcurl link-time ssl backend (nss) is different from compile-time ssl backend (none/other)

解决:

pip3 uninstall pycurl

export PYCURL_SSL_LIBRARY=nss

pip3 install pycurl

相关链接

评论可见,请评论后查看内容,谢谢!!!评论后请刷新页面。