在Ubuntu服务器上运行Python3命令时出错?

2024-03-29 12:28:38 发布

您现在位置:Python中文网/ 问答频道 /正文

我正试图使用命令($python3es7.py)在Ubuntu服务器上运行python命令。 但是得到了错误(ModuleNotFoundError:No module name'confluent\u kafka')。你知道吗

我的es7.py脚本

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)

Tags: producerkafkapyimport命令服务器ubuntu错误