gpt4 book ai didi

Python - 导入 tweepy ImportError : No module named tweepy

转载 作者:太空狗 更新时间:2023-10-30 02:15:35 50 4
gpt4 key购买 nike

我安装了 pip install tweepy 并且安装没有错误。

Requirement already satisfied: tweepy in /Library/Python/2.7/site-packages
Requirement already satisfied: requests>=2.11.1 in /Library/Python/2.7/site-packages (from tweepy)
Requirement already satisfied: PySocks>=1.5.7 in /Library/Python/2.7/site-packages (from tweepy)
Requirement already satisfied: six>=1.10.0 in /Library/Python/2.7/site-packages (from tweepy)
Requirement already satisfied: requests-oauthlib>=0.7.0 in /Library/Python/2.7/site-packages (from tweepy)
Requirement already satisfied: certifi>=2017.4.17 in /Library/Python/2.7/site-packages (from requests>=2.11.1->tweepy)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in /Library/Python/2.7/site-packages (from requests>=2.11.1->tweepy)
Requirement already satisfied: idna<2.7,>=2.5 in /Library/Python/2.7/site-packages (from requests>=2.11.1->tweepy)
Requirement already satisfied: urllib3<1.23,>=1.21.1 in /Library/Python/2.7/site-packages (from requests>=2.11.1->tweepy)
Requirement already satisfied: oauthlib>=0.6.2 in /Library/Python/2.7/site-packages (from requests-oauthlib>=0.7.0->tweepy)

这是我的代码:

import tweepy
from tweepy import OAuthHandler

consumer_key = 'consumer_key'
consumer_secret = 'consumer_secret'

access_token = 'access_token'
access_token_secret = 'access_token_secret'

auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)

api = tweepy.API(auth)

public_tweepy.API('Yunus Hatipoglu')

for tweet in public_tweets:
print(tweet.text)
analysis = TextBlob(tweet.text)
print(analysis.sentiment)

作为应用程序,我使用 Pycharm,我的操作系统是 OSX。

python3 --版本:Python 3.6.4

当我运行我的代码时,出现以下错误:

import tweepy

ImportError: No module named tweepy

最佳答案

in PyCharm, Settings -> Project Interpreter -> + -> tweepy -> install package.

通过以上操作,Tweepy 已经在 PyCharm 终端中工作了。

另一方面,我通过输入 python3 -m pip install tweepy

安装了 tweepy

关于Python - 导入 tweepy ImportError : No module named tweepy,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49455602/

50 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com