python - 在 Ubuntu 服务器上运行 Python3 命令时出错?
问题描述
我正在尝试使用命令($ python3 es7.py)在 Ubuntu 服务器中运行 python 命令。但是得到了错误(ModuleNotFoundError: No module named 'confluent_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)
解决方案
推荐阅读
- unity3d - Destroy(gameObject) 仅在订阅事件时有效
- javascript - 在 JavaScript 中预处理音频数据(fft 频谱、峰值等)
- react-native - 在按钮按下 React Native 时重置 StackNavigator
- html - 我怎样才能在这里使用另一个 css 库颜色而不是 Material Design?
- c++ - 从模板化函数中调用模板化类的模板化成员,带有显式参数
- visual-c++ - 我正在尝试在控制台中间打印我的正方形
- reactjs - 模块构建失败:TypeError:无法读取未定义的属性“babel”
- arrays - 在 Unity 中为按钮数组中的每个按钮分配整数值
- c++ - C++ 在循环中生成新随机数的问题/出现提示时
- visual-studio-code - Vscode 中的 dart 不支持全局评估