web-dev-qa-db-ja.com

407 Proxy Authentication Requiredでpipインストールが失敗する

次のpip installコマンドを使用しようとしていますが、プロキシ認証で問題が発生します。 RHEL7.xサーバー内で既にプロキシを構成しています。

Command Used: `pip install --proxy https://'username:pwd'@proxy:Host  --upgrade pip`

ログ:

Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', error('Tunnel connection failed: 407 Proxy Authentication Required',))': /simple/pip/
Retrying (Retry(total=3, connect=None, read=None, redirect=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', error('Tunnel connection failed: 407 Proxy Authentication Required',))': /simple/pip/
Retrying (Retry(total=2, connect=None, read=None, redirect=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', error('Tunnel connection failed: 407 Proxy Authentication Required',))': /simple/pip/
Retrying (Retry(total=1, connect=None, read=None, redirect=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', error('Tunnel connection failed: 407 Proxy Authentication Required',))': /simple/pip/
Retrying (Retry(total=0, connect=None, read=None, redirect=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', error('Tunnel connection failed: 407 Proxy Authentication Required',))': /simple/pip/

これは最初に試すべきものです:

コマンドプロンプト(CMD)を開きます。

プロキシ設定をエクスポートします。

:\set http_proxy=http://username:password@proxyAddress:port

:\set https_proxy=https://username:password@proxyAddress:port

インストールするパッケージをインストールします。

:\pip install PackageName

9

エラー407は、プロキシの認証がない/間違っていることを意味します。 '部分からusername:pwdを削除します。つまり、pip install --proxy https://username:pwd@proxy:Hostを使用します。

Pythonパッケージを別のオプションとしてインストールする直前に、そのサーバーからインターネット接続を開いてみてください。

これが役に立たない場合は、質問への回答で指定されているオプションを試してください herehere および here

2
bastelflp

ターミナルを開き、次を実行します。

export http_proxy=http://username:password@proxyAddress:port
export https_proxy=https://username:password@proxyAddress:port

これをWindowsのgit bashで試します。環境変数にパスワードがないと、より良い答えが見つかりませんでした。

このコードを保存して、ホームディレクトリに「.bashrc」ファイルを作成できます。

1
negas

私はインストールできる以下のコマンドを使用して同じ問題に直面しています

Sudo pip install PackageName