Python パッケージ .whl ファイルをインストールする方法

新しい Python パッケージまたはライブラリをインストールする最も一般的な方法は、pip
または easy_install
使用してインストールされています。これは Python チュートリアルのインストールセクションで 紹介した方法です。しかし、インターネットアクセスの制限などでこれらのツールを使用できない場合があります。ここでは、.whl
ファイルを使用して新しい Python パッケージをインストールする方法を紹介します。
-
pip
がシステムにインストールされているか確認しますpip
またはpip.exe
認識されない場合は、pip
インストールチュートリアルでインストールします。または、Python スクリプトディレクトリにあるが、スクリプトパスがシステム変数にないかどうかを確認できます。次に、システム変数PATH
に Python スクリプトパスを追加するだけです。set PATH=C:\Python\Scripts;%PATH%
上記のコマンドにより、
C:\Python\Scripts
がシステム環境変数に追加されます。 -
.whl
ファイルをダウンロードするこの信頼できる UCI Web サイト から Python 拡張パッケージの非公式の Windows バイナリをダウンロードできます。
-
.whl
ファイルをインストールするたとえば、
pycairo-1.16.3-cp27-cp27m-win32.whl
をフォルダーC:\Downloads\
にダウンロードしました。以下のコマンドを使用して、whl
パッケージファイルをインストールします。pip install C:\Downloads\pycairo-1.16.3-cp27-cp27m-win32.whl
完了しました。幸運を!
Founder of DelftStack.com. Jinku has worked in the robotics and automotive industries for over 8 years. He sharpened his coding skills when he needed to do the automatic testing, data collection from remote servers and report creation from the endurance test. He is from an electrical/electronics engineering background but has expanded his interest to embedded electronics, embedded programming and front-/back-end programming.
LinkedIn