简体   繁体   中英

Error when running Python3 command in Ubuntu server?

I'm trying to run a python command in Ubuntu server by using command ($ python3 es7.py). But got the error (ModuleNotFoundError: No module named 'confluent_kafka').

My es7.py script

from confluent_kafka import Producer
import json
import requests
import time
p = Producer({"bootstrap_servers": "localhost:9092"})
while True:
    response1 = requests.get("http://api.openweathermap.org/data/2.5/weather?q=jaipur&appid=**")
    p.produce('weather', key='jaipur', value=response1.text)

You don't seem to have the necessary dependency (confluent_kafka) installed on the ubuntu server. Install it first.

You can install it with:

pip install confluent-kafka

As described here .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM