我已经安装了python请求模块.我使用标准pip install requests
,安装成功但它根本不起作用.我无法将此模块导入任何脚本文件.我总是得到一个错误.
Traceback (most recent call last): File "D:\Rzeczy Mariusza\Python\aaaa.py", line 3, inimport requests File "D:\Programy\Python34\lib\site-packages\requests\__init__.py", line 58, in from . import utils File "D:\Programy\Python34\lib\site-packages\requests\utils.py", line 12, in import cgi File "D:\Programy\Python34\lib\cgi.py", line 39, in from email.parser import FeedParser File "D:\Programy\Python34\lib\email\parser.py", line 12, in from email.feedparser import FeedParser, BytesFeedParser File "D:\Programy\Python34\lib\email\feedparser.py", line 27, in from email import message File "D:\Programy\Python34\lib\email\message.py", line 16, in from email import utils File "D:\Programy\Python34\lib\email\utils.py", line 40, in from email.charset import Charset File "D:\Programy\Python34\lib\email\charset.py", line 15, in import email.quoprimime File "D:\Programy\Python34\lib\email\quoprimime.py", line 44, in from string import ascii_letters, digits, hexdigits ImportError: cannot import name 'ascii_letters' [Finished in 0.2s with exit code 1]
奇怪的是,当我使用IDLE时,我可以毫无问题地导入它(模块).我运行,Python 3.4.3 (v3.4.3:9b73f1c3e601, Feb 24 2015, 22:43:06) [MSC v.1600 32 bit (Intel)] on win32
如果该信息有帮助.
这通常意味着您string.py
在执行它的同一文件夹中调用了一个脚本,并且它会混乱导入.
如果确实如此,请考虑重命名.