python kafka ‘<SimpleProducer batch=%s>‘ % self.async
【代码】python kafka ‘<SimpleProducer batch=%s>‘ % self.async。
·
Traceback (most recent call last):
File "E:\dikongjingji\PyFlinkJob_new\FlinkJob_Python\common\util\mock_datagen.py", line 4, in <module>
from kafka import KafkaProducer
File "C:\Python\Python38\lib\site-packages\kafka\__init__.py", line 23, in <module>
from kafka.producer import KafkaProducer
File "C:\Python\Python38\lib\site-packages\kafka\producer\__init__.py", line 4, in <module>
from .simple import SimpleProducer
File "C:\Python\Python38\lib\site-packages\kafka\producer\simple.py", line 54
return '<SimpleProducer batch=%s>' % self.async
^
SyntaxError: invalid syntax
kafka 是一个比较旧的库,会有兼容性问题
如果已经下载了 kafka ,需要先使用pip删除这个包
然后下载另一个依赖包:
pip install kafka-python
kafka 与 kafka-python同时拥有应该会报错,这时需要都卸载这两个包
github地址:https://github.com/dpkp/kafka-python
更多推荐
已为社区贡献1条内容
所有评论(0)