Python 运行与RabbitMQ相关的sender.py和receiver.py文件时出错

Python 运行与RabbitMQ相关的sender.py和receiver.py文件时出错,python,rabbitmq,Python,Rabbitmq,运行发送方和接收方文件时出现错误堆栈 Traceback (most recent call last): File "C:/Users/A3245643/PycharmProjects/events/receive.py", line 7, in <module> connection = pika.BlockingConnection(pika.ConnectionParameters(host='localhost')) File "

运行发送方和接收方文件时出现错误堆栈

Traceback (most recent call last):
  File "C:/Users/A3245643/PycharmProjects/events/receive.py", line 7, in <module>
    connection = pika.BlockingConnection(pika.ConnectionParameters(host='localhost'))
  File "C:\Users\A6002043\AppData\Local\Programs\Python\Python38\lib\site-packages\pika\adapters\blocking_connection.py", line 359, in __init__
    self._impl = self._create_connection(parameters, _impl_class)
  File "C:\Users\A6002043\AppData\Local\Programs\Python\Python38\lib\site-packages\pika\adapters\blocking_connection.py", line 450, in _create_connection
    raise self._reap_last_connection_workflow_error(error)
pika.exceptions.AMQPConnectionError
recieve.py充当消费者

# from send import channel


import pika, sys, os


connection = pika.BlockingConnection(pika.ConnectionParameters(host='localhost'))
channel = connection.channel()

channel.queue_declare(queue='iptbotQueue')


def callback(ch, method, properties, body):
    print(" [x] Received %r" % body)

channel.basic_consume(queue='iptbotQueue',
                      auto_ack=True,
                      on_message_callback=callback)

print(' [*] Waiting for messages. To exit press CTRL+C')
channel.start_consuming()
我已经设置了rabbit mq,所以我应该用下图中的url替换localhost值吗


我想我需要为localhost值提供IP地址(例如:172.11.12.33)

或者只添加主机名而不添加“http”示例slacktestbot mq.omnitank.bestbuy.com

# from send import channel


import pika, sys, os


connection = pika.BlockingConnection(pika.ConnectionParameters(host='localhost'))
channel = connection.channel()

channel.queue_declare(queue='iptbotQueue')


def callback(ch, method, properties, body):
    print(" [x] Received %r" % body)

channel.basic_consume(queue='iptbotQueue',
                      auto_ack=True,
                      on_message_callback=callback)

print(' [*] Waiting for messages. To exit press CTRL+C')
channel.start_consuming()