我安装了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 --版本:Python3.6.4
当我运行我的代码时,我会得到以下错误:
进口吐温 ImportError:没有名为tweepy的模块
发布于 2018-03-23 18:18:26
在PyCharm中,设置->项目解释器-> + -> tweepy ->安装包。
通过以上操作,Tweepy已经在PyCharm终端上工作了。
另一方面,我通过输入python3 -m pip install tweepy安装了tweepy
发布于 2018-03-23 18:00:20
尝试通过以下命令安装:
python3 -m pip install tweepy发布于 2020-03-31 14:51:51
我直接将它安装在Python文件夹中,但它对我不起作用。
之后,我在同一提示符下使用:pip uninstall tweepy卸载。
所以,我使用了Anaconda提示符,在代码:pip install tweepy之后,它为我工作。
我希望这是有用的。
https://stackoverflow.com/questions/49455602
复制相似问题