ImportError:无法从“预处理器”导入名称“TwitterPreprocessor”

2024-10-03 02:42:32 发布

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

我安装包是为了清理数据

!pip install tweet-preprocessor
from preprocessor import TwitterPreprocessor

我同时使用Jupyter和Colab,在Jupyter中使用没有问题。但是,在colab收到这个问题:

导入错误:无法从“预处理器”导入名称“TwitterPreprocessor”(/usr/local/lib/python3.7/dist-packages/preprocessor/init.py)

请帮我纠正这个问题

谢谢你


Tags: installpip数据fromimport名称错误jupyter
1条回答
网友
1楼 · 发布于 2024-10-03 02:42:32

tweet-preprocessor根本没有您试图导入的TwitterPreprocessor。看看眼前的GitHub repo-noTwitterPreprocessor

建议通过以下方式导入:import preprocessor as p(或者从GitHub repo导入上述名称之一)。您可以查看^{}可以导入哪些名称

ImportError: cannot import name 'TwitterPreprocessor' from 'preprocessor' ([...]\preprocessor\_init_.py)

相关问题 更多 >