【问题标题】:Problem Importing Python Twint Module to Jupyter Notebook - ModuleNotFoundError: No module named 'twint'将 Python Twint 模块导入 Jupyter Notebook 时出现问题 - ModuleNotFoundError: No module named 'twint'
【发布时间】:2021-07-13 10:55:34
【问题描述】:

当我尝试将 twint 包 (https://pypi.org/project/twint/) 导入 Jupyter Notebook 时,我收到一条错误消息。

import twint

ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-1-5772b804c290> in <module>
----> 1 import twint

ModuleNotFoundError: No module named 'twint' 

但我知道twint 已经安装好了。

C:\Users\my_user>pip show twint

Name: twint
Version: 2.1.20
Summary: An advanced Twitter scraping & OSINT tool.
Home-page: https://github.com/twintproject/twint
Author: Cody Zacharias
Author-email: codyzacharias@pm.me
License: MIT
Location: c:\users\my_user\appdata\local\programs\python\python39\lib\site-packages
Requires: beautifulsoup4, pysocks, aiohttp, cchardet, googletransx, schedule, geopy, fake- 
useragent, aiohttp-socks, elasticsearch, pandas, aiodns
Required-by:

我看过Python "ImportError: No module named twint" on Atom trying to use twint (Python Module),我知道我没有安装两个版本的python。

我该如何前进?我想使用这个或类似的模块,而不是 Twitter API。

谢谢!

【问题讨论】:

    标签: python web-scraping jupyter-notebook twint


    【解决方案1】:

    我今天早上尝试开始使用 twint 时遇到了同样的问题。
    似乎 twint 只与 python 3.6 兼容,而我使用的是更新的版本。我下载了python 3.6,然后跑了

    python3.6 -m pip install twint
    

    在命令行中。现在似乎可以工作了。

    【讨论】:

    • 感谢您的帮助,我用python 3.6创建了一个虚拟环境,twint运行得很好!
    【解决方案2】:

    导入nest_asyncio nest_asyncio.apply() 在导入 twint 之前输入这个

    【讨论】:

      猜你喜欢
      • 2020-03-03
      • 2017-12-15
      • 1970-01-01
      • 2020-08-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-06-23
      • 1970-01-01
      相关资源
      最近更新 更多