运行python总是出现如下错误:
File "/usr/local/lib/python2.7/urllib.py", line 30, in <module> from urlparse import urljoin as basejoin File "/usr/local/lib/python2.7/urlparse.py", line 110, in <module> from collections import namedtuple File "/usr/local/lib/python2.7/collections.py", line 10, in <module> from keyword import iskeyword as _iskeyword File "/usr/local/lib/python2.7/urllib2.py", line 94, in <module> import httplib File "/usr/local/lib/python2.7/httplib.py", line 72, in <module> from urlparse import urlsplit ImportError: cannot import name urlsplit
上网查了资料才发现,是因为在运行python脚本的目录下,是不允许有.pyc文件,
把目录下的.pyc文件移除,即可解决
原创文章,转载请注明:转载自Web开发笔记 | Python: import 导入库文件错误
本文链接地址:https://www.magentonotes.com/python-import-lib-error.html
Comments on this entry are closed.