Install the ApsaraMQ for RocketMQ Python SDK and prepare the resources you need to send and receive messages.
Prerequisites
Python 3.7 or later. Download from python.org.
An ApsaraMQ for RocketMQ instance with the following resources created in the console. For instructions, see Create resources.
Instance
Topic
Consumer group
Install the SDK
Create and activate a virtual environment to isolate dependencies:
python -m venv .venv source .venv/bin/activate # Linux or macOS .venv\Scripts\activate # WindowsInstall the
rocketmq-python-clientpackage:pip install rocketmq-python-client==5.1.1
Next steps
Sample code for the SDK for Python -- Replace the placeholders with your values, run the sample code, and verify that messages are sent and received.
Version guide -- SDK version history and compatibility.