Python学習ノート_問題の解決_001


pipが実行時にエラーについて

  • pipで直接使えない場合があります。(外部サイトへのアクセス制限あり)
    下記のようにパッケージをインストール時にはエラーになる解決方法はproxyサーバー経由でアクセスする
エラー内容_01.txt
 'Connection to pypi.org timed out. (connect timeout=15)'
pipコマンド_01.txt
修正前:
pip install <PACKAGE_NAME>
修正後:
pip install <PACKAGE_NAME> --proxy http://<PROXY_URL>:<PORT_NO>
  • 上記の方法でも解決できない時もあります。
    下記のようなssh認証のエラーが発生したら、pipのパラメーターに「--trusted-host pypi.org --trusted-host files.pythonhosted.org」を追加することで解決できます。
エラー内容_02.txt
Could not fetch URL https://pypi.org/simple/ibm-db/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url:
/simple/ibm-db/ (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1108)'))
) - skipping
修正前:
pip install <PACKAGE_NAME> --proxy http://<PROXY_URL>:<PORT_NO>
修正後:
pip install <PACKAGE_NAME> --trusted-host pypi.org --trusted-host files.pythonhosted.org --proxy http://<PROXY_URL>:<PORT_NO>