Jupyter Notebook无法找到模块

问题描述 投票:1回答:1

嗨,我一直在尝试为Jupyter Notebook安装twython。我通过python repl证明它在我的笔记本电脑中普遍安装。但它仍然不会出现在Jupyter笔记本上。寻找帮助试图弄清楚它是在我的Anaconda 3 Jupyter笔记本可以找到的地方。

背景:家庭作业任务试图挖掘推特上的推文

这是我收到的错误,我正在运行Mac OS

/Users/rachelmanca/twitter/__init__.py:22: UserWarning: The twython library has not been installed. Some functionality from the twitter package will not be available.
  "The twython library has not been installed. "
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-4-38297a1141e0> in <module>
----> 1 import twitter
      2 import twython
      3 #---------------------------------------------
      4 # Define a Function to Login Twitter API
      5 def oauth_login():

~/twitter/__init__.py in <module>
     34 
     35 
---> 36 from nltk.twitter.common import json2csv

ModuleNotFoundError: No module named 'nltk.twitter
python-3.x twitter jupyter-notebook anaconda twython
1个回答
0
投票

你安装了nltk包吗?

如果没有,那就去做:

  1. pip3 install -U nltk
  2. 然后运行python3
  3. 在python3命令行中,运行: import nltk nltk.download()
  4. 下载后,重新启动jupyter,然后再次运行代码。
© www.soinside.com 2019 - 2024. All rights reserved.