kazuuu.net

テクノロジー・データ分析・実践ログ・その他

Python用のTwitterライブラリ「Tweepy」をインストールする(Windows10)

カテゴリ: Python【初歩から現場実務的なもの】

Python用のTwitterライブラリ「Tweepy」をインストールしてみます。

■Python

今回のPythonのバージョンは、「3.8.5」を使用しています。(Windows10)(pythonランチャーでの確認)

■Tweepyをインストールする

Tweepyをインストールを行いますが、今回はpipを経由してインストールを行うので、まずWindowsのコマンドプロンプトを起動します。

pip install tweepy

起動後、上記のコマンドを入力し、Enterキーを押します。

なお、今回は、pythonランチャーを使用しており、Python Version 3.8.5にインストールを行うために、pipを使う場合にはコマンドでの切り替えを行います。

py -3.8 -m pip install tweepy

切り替えるために、上記のコマンドを入力し、Enterキーを押します。

Collecting tweepy

Downloading tweepy-3.9.0-py2.py3-none-any.whl (30 kB)

Requirement already satisfied: six>=1.10.0 in c:\pg\python38\lib\site-packages (from tweepy) (1.15.0)

Collecting requests-oauthlib>=0.7.0

Downloading requests_oauthlib-1.3.0-py2.py3-none-any.whl (23 kB)

Requirement already satisfied: requests[socks]>=2.11.1 in c:\pg\python38\lib\site-packages (from tweepy) (2.25.0)

Collecting oauthlib>=3.0.0

Downloading oauthlib-3.1.0-py2.py3-none-any.whl (147 kB)

|████████████████████████████████| 147 kB 1.3 MB/s

Requirement already satisfied: chardet<4,>=3.0.2 in c:\pg\python38\lib\site-packages (from requests[socks]>=2.11.1->tweepy) (3.0.4)

Requirement already satisfied: urllib3<1.27,>=1.21.1 in c:\pg\python38\lib\site-packages (from requests[socks]>=2.11.1->tweepy) (1.26.2)

Requirement already satisfied: certifi>=2017.4.17 in c:\pg\python38\lib\site-packages (from requests[socks]>=2.11.1->tweepy) (2020.11.8)

Requirement already satisfied: idna<3,>=2.5 in c:\pg\python38\lib\site-packages (from requests[socks]>=2.11.1->tweepy) (2.10)

Collecting PySocks!=1.5.7,>=1.5.6; extra == "socks"

Downloading PySocks-1.7.1-py3-none-any.whl (16 kB)

Installing collected packages: oauthlib, requests-oauthlib, tweepy, PySocks

Successfully installed PySocks-1.7.1 oauthlib-3.1.0 requests-oauthlib-1.3.0 tweepy-3.9.0

Enterキーを押すと、インストールが開始され、「Successfully installed」と表示されれば、正常にTweepyのインストールは完了となります。