我正在 Google Collab 和 Jupyter Notebooks 中尝试。
在 Jupyter Notebooks 中,出现以下错误:
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
Cell In[5], line 1
----> 1 from utils import process_tweet, build_freqs
ImportError: cannot import name 'process_tweet' from 'utils' (C:\Users\Gabriel\anaconda3\Lib\site-packages\utils\__init__.py)`
我能做什么?
之前的代码:
import nltk
from nltk.corpus import twitter_samples
import matplotlib.pyplot as plt
import numpy as np
nltk.download('twitter_samples')
nltk.download('stopwords')
!pip install utils
from utils import process_tweet, build_freqs
使用
!pip install utils
,您已经安装了 一些随机 utils
软件包,现在当您尝试从 utils
导入时,您最终会尝试从那里导入。
除非你知道你需要这个
utils
,否则我建议!pip uninstall -y utils
摆脱它。