webmaster-kazu.com

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

シンプルな短縮URLサービスのAPIを利用できる「pyshorteners」ライブラリをインストールする

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

Pythonでシンプルな短縮URLサービスのAPIを利用できる「pyshorteners」のインストールについて解説しています。(Windows10)

pyshortenersは、短縮URLのサービスを使用し、URLを短縮および拡張するのに役立つライブラリ・モジュールです。

■Python

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

■pyshortenersをインストールする

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

pip install pyshorteners

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

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

py -3.8 -m pip install pyshorteners

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

Collecting pyshorteners

Downloading pyshorteners-1.0.1.tar.gz (10.0 kB)

Requirement already satisfied: requests in c:\users\user\appdata\local\packages\pythonsoftwarefoundation.python.3.8_qbz5n2kfra8p0\localcache\local-packages\python38\site-packages (from pyshorteners) (2.21.0)

Requirement already satisfied: certifi>=2017.4.17 in c:\users\user\appdata\local\packages\pythonsoftwarefoundation.python.3.8_qbz5n2kfra8p0\localcache\local-packages\python38\site-packages (from requests->pyshorteners) (2020.4.5.1)

Requirement already satisfied: idna<2.9,>=2.5 in c:\users\user\appdata\local\packages\pythonsoftwarefoundation.python.3.8_qbz5n2kfra8p0\localcache\local-packages\python38\site-packages (from requests->pyshorteners) (2.8)

Requirement already satisfied: urllib3<1.25,>=1.21.1 in c:\users\user\appdata\local\packages\pythonsoftwarefoundation.python.3.8_qbz5n2kfra8p0\localcache\local-packages\python38\site-packages (from requests->pyshorteners) (1.24.3)

Requirement already satisfied: chardet<3.1.0,>=3.0.2 in c:\users\user\appdata\local\packages\pythonsoftwarefoundation.python.3.8_qbz5n2kfra8p0\localcache\local-packages\python38\site-packages (from requests->pyshorteners) (3.0.4)

Building wheels for collected packages: pyshorteners

Building wheel for pyshorteners (setup.py) ... done

Created wheel for pyshorteners: filename=pyshorteners-1.0.1-py3-none-any.whl size=17511 sha256=0b4baccb9958cac0e56584559efe0a74b077bc52ef1b896aef997246aeb296eb

Stored in directory: c:\users\user\appdata\local\pip\cache\wheels\0f\6e\88\f0c854fa281b13d4997e9068dd69201e51c4b051c52c30b48d

Successfully built pyshorteners

Installing collected packages: pyshorteners

Successfully installed pyshorteners-1.0.1

Enterキーを押すと、インストールが開始され、上記のように「Successfully installed」と表示されます。これが表示されれば、pyshortenersが正常にインストールされたことになります。