プロキシー環境でPythonのpyinstallerがインストールできない時の対応
2021/01/22Pythonpyinstaller,Pythonの基本
記事内に広告が含まれています。
Pythonで書かれたスクリプトをWindowsのexeファイル化するpyinstallerですが、プロキシーサーバーを利用している環境下で上手くインストールできない現象が発生しました。
pyinstallerをインストールできない
pipコマンドを使ってpyinstallerをインストールしようとしても、ずっと処理待ちの状態になって、しばらくするとタイムアウトしてしまうという現象にあいました。
調べてみると同じような現象がすでに現れて解決されている方がいたので、その方法をためしてみました。
どうやら環境変数に
HTTP_PROXY HTTPS_PROXY
の2つを設定してやるだけでよいらしい。
早速実行してみました。
C:\tmp> set HTTP_PROXY=http://{プロキシーサーバ}
C:\tmp> set HTTPS_PROXY=http://{プロキシーサーバ}
C:\tmp> pip install pyinstaller --proxy=http://{プロキシーサーバ}
実行結果は
Collecting pyinstaller
Using cached pyinstaller-4.2.tar.gz (3.6 MB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing wheel metadata ... done
Requirement already satisfied: setuptools in c:\xxxxxx\python\python37\lib\site-packages (from pyinstaller) (41.2.0)
Requirement already satisfied: importlib-metadata in c:\users\xxxx\appdata\local\programs\python\python37\lib\site-packages (from pyinstaller) (1.4.0)
Collecting pefile>=2017.8.1
Downloading pefile-2019.4.18.tar.gz (62 kB)
|████████████████████████████████| 62 kB 79 kB/s
Requirement already satisfied: future in c:\users\xxxxx\appdata\local\programs\python\python37\lib\site-packages (from pefile>=2017.8.1->pyinstaller) (0.18.2)
Collecting pyinstaller-hooks-contrib>=2020.6
Downloading pyinstaller_hooks_contrib-2020.11-py2.py3-none-any.whl (172 kB)
|████████████████████████████████| 172 kB 6.4 MB/s
Collecting pywin32-ctypes>=0.2.0
Downloading pywin32_ctypes-0.2.0-py2.py3-none-any.whl (28 kB)
Collecting altgraph
Downloading altgraph-0.17-py2.py3-none-any.whl (21 kB)
Requirement already satisfied: zipp>=0.5 in c:\users\xxxxx\appdata\local\programs\python\python37\lib\site-packages (from importlib-metadata->pyinstaller) (2.0.0)
Requirement already satisfied: more-itertools in c:\users\xxxxx\appdata\local\programs\python\python37\lib\site-packages (from zipp>=0.5->importlib-metadata->pyinstaller) (8.1.0)
Building wheels for collected packages: pyinstaller, pefile
Building wheel for pyinstaller (PEP 517) ... done
Created wheel for pyinstaller: filename=pyinstaller-4.2-py3-none-any.whl size=2413076 sha256=xxxxx
Stored in directory: c:\users\xxxxx\appdata\local\pip\cache\wheels\85\03\fe\xxxx
Building wheel for pefile (setup.py) ... done
Created wheel for pefile: filename=pefile-2019.4.18-py3-none-any.whl size=60827 sha256=xxxxx
Stored in directory: c:\users\xxxxx\appdata\local\pip\cache\wheels\e4\0c\b1\xxxxx
Successfully built pyinstaller pefile
Installing collected packages: pywin32-ctypes, pyinstaller-hooks-contrib, pefile, altgraph, pyinstaller
Successfully installed altgraph-0.17 pefile-2019.4.18 pyinstaller-4.2 pyinstaller-hooks-contrib-2020.11 pywin32-ctypes-0.2.0
C:\tmp>
なんと、すんなりと完了。
無事インストールできました。
これでWindowsで実行可能なexeファイルが作れます。
リンク
システムトラストでは一緒に働いていただける仲間を募集中です。
Posted by システムトラスト技術部X
関連記事

Pythonの関数の作り方
Pythonでは関数を宣言するには「def」を使って宣言します。関数を作ることに ...

Pythonのクラスコンストラクター。__new__と__init__
Pythonのコンストラクターには__new__と__init__の2つのコンス ...

Pythonの処理ブロックは半角空白、タブの数を合わせてインデント(ネスト)させる
PythonはJavaやC言語と違い、処理のブロックを「{ }」ではなく、ネスト ...

Pythonのスライスの使い方
Pythonにはスライスと呼ばれる「リスト、文字列、タプル、バイト列」変数からイ ...

Pythonでクラスを継承する方法
Pythonのクラス継承はサブクラス(子クラス)の宣言時の引数にベースクラス(親 ...







