gpt4 book ai didi

python - 导入一个模块(请求),出现错误 "cannot import name Random"

转载 作者:行者123 更新时间:2023-11-28 19:55:43 28 4
gpt4 key购买 nike

我有一个使用 requests 的 Python 脚本。它工作了很长时间。现在突然出现以下错误。我尝试重新安装 requests 但这并没有解决问题。我唯一能想到的导致错误的是我一直在运行 Django 开发服务器,所以也许我被黑了?请帮忙。

代码:

import requests
...

错误:

Traceback (most recent call last):
File "myfile.py", line 1, in <module>
import requests
File "/Users/myuser/.virtualenvs/mysite/lib/python2.7/site-packages/requests/__init__.py", line 58, in <module>
from . import utils
File "/Users/myuser/.virtualenvs/mysite/lib/python2.7/site-packages/requests/utils.py", line 12, in <module>
import cgi
File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/cgi.py", line 50, in <module>
import mimetools
File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/mimetools.py", line 6, in <module>
import tempfile
File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/tempfile.py", line 35, in <module>
from random import Random as _Random
ImportError: cannot import name Random

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com