gpt4 book ai didi

python - 导入错误 : No module named 'Queue'

转载 作者:IT老高 更新时间:2023-10-28 20:27:54 29 4
gpt4 key购买 nike

我正在尝试导入 requests 模块,但出现此错误我的 python 版本是 3.4,在 ubuntu 14.04 上运行

>>> import requests
Traceback (most recent call last):
File "/usr/local/lib/python3.4/dist-packages/requests/packages/urllib3/connectionpool.py", line 10, in <module>
from queue import LifoQueue, Empty, Full
ImportError: cannot import name 'LifoQueue'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.4/dist-packages/requests/__init__.py", line 58, in <module>
from . import utils
File "/usr/local/lib/python3.4/dist-packages/requests/utils.py", line 26, in <module>
from .compat import parse_http_list as _parse_list_header
File "/usr/local/lib/python3.4/dist-packages/requests/compat.py", line 7, in <module>
from .packages import chardet
File "/usr/local/lib/python3.4/dist-packages/requests/packages/__init__.py", line 3, in <module>
from . import urllib3
File "/usr/local/lib/python3.4/dist-packages/requests/packages/urllib3/__init__.py", line 10, in <module>
from .connectionpool import (
File "/usr/local/lib/python3.4/dist-packages/requests/packages/urllib3/connectionpool.py", line 12, in <module>
from Queue import LifoQueue, Empty, Full
ImportError: No module named 'Queue'

最佳答案

import queue 在 Python 3 中是 小写 q

Q改成q就可以了。

(有关智能切换,请参见 https://stackoverflow.com/a/29688081/632951 中的代码。)

关于python - 导入错误 : No module named 'Queue' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33432426/

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