gpt4 book ai didi

python - 如何修复 ImportError : No module named packages. urllib3?

转载 作者:太空狗 更新时间:2023-10-29 17:21:37 29 4
gpt4 key购买 nike

我在 Ubuntu 机器上运行 Python 2.7.6。当我在终端中运行 twill-sh(Twill 是一种用于测试网站的浏览器)时,我得到以下信息:

Traceback (most recent call last):
File "dep.py", line 2, in <module>
import twill.commands
File "/usr/local/lib/python2.7/dist-packages/twill/__init__.py", line 52, in <module>
from shell import TwillCommandLoop
File "/usr/local/lib/python2.7/dist-packages/twill/shell.py", line 9, in <module>
from twill import commands, parse, __version__
File "/usr/local/lib/python2.7/dist-packages/twill/commands.py", line 75, in <module>
browser = TwillBrowser()
File "/usr/local/lib/python2.7/dist-packages/twill/browser.py", line 31, in __init__
from requests.packages.urllib3 import connectionpool as cpl
ImportError: No module named packages.urllib3

但是,我可以在 Python 控制台中导入 urllib 就好了。可能是什么原因?

最佳答案

如果您已经从默认版本安装了“请求”,您可能需要

sudo pip install --upgrade requests

感谢@bkzland 对先前回答的评论:

I followed these steps having the same error, I needed to use sudo pip install --upgrade each time to make it work. – bkzland Dec 17 '15 at 12:57

---现在,我如何使它成为我的 setup.py 中的依赖项?

关于python - 如何修复 ImportError : No module named packages. urllib3?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27440060/

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