我正在尝试在python中使用rabbitmq。 我的代码是:
import pika
if __name__ == '__main__':
connection = pika.BlockingConnection(pika.ConnectionParameters(host='localhost'))
我使用以下方式运行此文件:
python3 test.py
错误签名:
Traceback (most recent call last):
File "Test.py", line 4, in <module>
connection = pika.BlockingConnection(pika.ConnectionParameters(host='localhost'))
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pika/adapters/blocking_connection.py", line 339, in __init__
self._process_io_for_connection_setup()
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pika/adapters/blocking_connection.py", line 374, in _process_io_for_connection_setup
self._open_error_result.is_ready)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pika/adapters/blocking_connection.py", line 395, in _flush_output
raise exceptions.ConnectionClosed()
pika.exceptions.ConnectionClosed
已经提到this,但我的代码中没有任何睡眠。 不确定会出现什么问题。 如果我遗漏了一些明显的东西,请告诉我。
答案 0 :(得分:0)
问题出在rabbitmqctl上。重新配置它,重新启动服务,问题得到解决。
提示:我尝试先使用&#39; brew&#39;但由于某种原因,我无法正确安装。所以安装了,rabbitmqctl作为一个单独的包并添加到PATH