我正在尝试运行以下代码:
import requests
import json
page = requests.get('https://www.wikipedia.org/')
但是我继续收到此错误:
AttributeError: module 'cgi' has no attribute 'FieldStorage'
此代码可在我的一台计算机上运行,但不能在另一台计算机上运行。 有任何想法吗?另外,我什至没有使用cgi模块,所以我不知道它来自哪里。
下面是完整的追溯:
Traceback (most recent call last):
File "C:/Users/Larson/AppData/Local/Programs/Python/Python36-
32/tetshjwbrifvheruiher.py", line 2, in <module>
import requests
File "C:\Users\Larson\AppData\Local\Programs\Python\Python36-32\lib\site-
packages\requests\__init__.py", line 97, in <module>
from . import utils
File "C:\Users\Larson\AppData\Local\Programs\Python\Python36-32\lib\site-
packages\requests\utils.py", line 11, in <module>
import cgi
File "C:/Users/Larson/AppData/Local/Programs/Python/Python36-32\cgi.py", line
2, in <module>
form = cgi.FieldStorage()
AttributeError: module 'cgi' has no attribute 'FieldStorage'