Windows에서 PIP Install 하면 SSL 에러가 되는 것을 해소한다.

5448 단어 파이썬pipWindows10

발생한 오류


(ptoe) D:\MyFile\arc\pyenv\ptoe>pip install pprint
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1108)'))': /simple/pprint/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1108)'))': /simple/pprint/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1108)'))': /simple/pprint/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1108)'))': /simple/pprint/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1108)'))': /simple/pprint/
Could not fetch URL https://pypi.org/simple/pprint/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pprint/ (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1108)'))) - skipping
ERROR: Could not find a version that satisfies the requirement pprint (from versions: none)
ERROR: No matching distribution found for pprint
Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1108)'))) - skipping

SSL 인증에 오류가 있습니다. 접속처를 신용할 수 없다는 것이지만 원인이 무엇인지는 모른다.
사용 PC이므로 너무 네트워크 설정을 괴롭히는 것도 무섭다.

해결 방법



구구했는데, pip의 옵션으로 접속처를 신뢰가 끝난 것으로 하면 OK인것 같다.
(MAC의 예뿐 Windows의 예가 적은 것이 불안하지만.)

「--trusted-host」옵션으로 인스톨시만 접속처의 사이트를 인증 OK로 한다.
필요한 것은 아래 3가지. 부족하면 위와 같은 오류가 발생합니다.
 --trusted-host pypi.python.org
 --trusted-host files.pythonhosted.org
 --trusted-host pypi.org

실천



1.PIP를 갱신한다.


(ptoe) D:\MyFile\arc\pyenv\ptoe>python -m pip install --trusted-host pypi.python.org --trusted-host files.pythonhosted.org --trusted-host pypi.org --upgrade pip
Collecting pip
  Downloading https://files.pythonhosted.org/packages/36/74/38c2410d688ac7b48afa07d413674afc1f903c1c1f854de51dc8eb2367a5/pip-20.2-py2.py3-none-any.whl (1.5MB)
     |████████████████████████████████| 1.5MB 3.3MB/s
Installing collected packages: pip
  Found existing installation: pip 19.2.3
    Uninstalling pip-19.2.3:
      Successfully uninstalled pip-19.2.3
Successfully installed pip-20.2

PIP 업그레이드가 다녔다! ! (´ω`)

2. 오류가 발생한 라이브러리 설치


(ptoe) D:\MyFile\arc\pyenv\ptoe>python -m pip install --trusted-host pypi.python.org --trusted-host files.pythonhosted.org --trusted-host pypi.org pip pprint
Requirement already satisfied: pip in ![コメント 2020-08-04 155203.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/600163/6dea129d-3250-af0c-fff9-bb139a38391f.png)
d:\myfile\arc\pyenv\ptoe\lib\site-packages (20.2)
Collecting pprint
  Downloading pprint-0.1.tar.gz (860 bytes)
Using legacy 'setup.py install' for pprint, since package 'wheel' is not installed.
Installing collected packages: pprint
    Running setup.py install for pprint ... done
Successfully installed pprint-0.1

라이브러리도 성공적으로 설치할 수 있었다.

영속화



매번 「--trusted-host」를 3개나 써 설치하는 것은 조금...
그렇다면 pip.ini를 작성하고 작성하면 이후에는 --trusted-host 옵션을 지정할 필요가 없습니다.
[global]
trusted-host = pypi.python.org
               pypi.org
               files.pythonhosted.org

Windows의 경우 pip.ini를 어디에 두면 좋은지 전혀 몰랐지만,
pip의 공식 문서에 썼다.
#ユーザーローカルの場合
%APPDATA%\pip\pip.ini

#グローバルの場合
C:\ProgramData\pip\pip.ini

#仮想環境(venv)の場合
%VIRTUAL_ENV%\pip.ini

가상 환경의 저장 이미지


참고



htps : // 기주 b. 코m/py파/피p/이스에 s/5448
htps : // / p. py 빠. 이오 / 엔 / s 타 b / 우세 r_ 구이 / / 곤후 쿠라 치온

좋은 웹페이지 즐겨찾기