如何使用python 3.7.4在Windows上使用pip安装flask并安装pip?

时间:2019-08-22 17:34:33

标签: python pip

当我做pip install Flask时遇到错误:

Could not find a version that satisfies the requirement Flask (from versions: )
No matching distribution found for Flask

我该怎么做才能安装Flask?

Microsoft Windows [Version 10.0.17134.885]
(c) 2018 Microsoft Corporation. כל הזכויות שמורות.

C:\Users\מחשב>cd Documents

C:\Users\מחשב\Documents>cd C:\Users\מחשב\Documents\pyton

C:\Users\מחשב\Documents\pyton>mkdir myproject
A subdirectory or file myproject already exists.

C:\Users\מחשב\Documents\pyton>myproject
'myproject' is not recognized as an internal or external command,
operable program or batch file.

C:\Users\מחשב\Documents\pyton>mkdir myproject

C:\Users\מחשב\Documents\pyton>cd myproject

C:\Users\מחשב\Documents\pyton\myproject>python3 -m venv venv
'python3' is not recognized as an internal or external command,
operable program or batch file.

C:\Users\מחשב\Documents\pyton\myproject>py -3 -m venv venv

C:\Users\מחשב\Documents\pyton\myproject>venv\Scripts\activate

(venv) C:\Users\מחשב\Documents\pyton\myproject>pip install Flask
Collecting Flask
  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:1076)'))': /simple/flask/
  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:1076)'))': /simple/flask/
  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:1076)'))': /simple/flask/
  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:1076)'))': /simple/flask/
  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:1076)'))': /simple/flask/
  Could not fetch URL https://pypi.org/simple/flask/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/flask/ (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1076)'))) - skipping
  Could not find a version that satisfies the requirement Flask (from versions: )
No matching distribution found for Flask
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:1076)'))) - skipping

(venv) C:\Users\מחשב\Documents\pyton\myproject>python -m ensurepip --default-pip
Looking in links: C:\Users\84D7~1\AppData\Local\Temp\tmpljqyz7od
Requirement already satisfied: setuptools in c:\users\מחשב\documents\pyton\myproject\venv\lib\site-packages (40.8.0)
Requirement already satisfied: pip in c:\users\מחשב\documents\pyton\myproject\venv\lib\site-packages (19.0.3)

(venv) C:\Users\מחשב\Documents\pyton\myproject>pip -V
pip 19.0.3 from c:\users\מחשב\documents\pyton\myproject\venv\lib\site-packages\pip (python 3.7)

(venv) C:\Users\מחשב\Documents\pyton\myproject>py -3 -m venv venv

(venv) C:\Users\מחשב\Documents\pyton\myproject>venv\Scripts\activate

(venv) C:\Users\מחשב\Documents\pyton\myproject>pip install Flask
Collecting Flask
  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:1076)'))': /simple/flask/
  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:1076)'))': /simple/flask/
  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:1076)'))': /simple/flask/
  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:1076)'))': /simple/flask/
  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:1076)'))': /simple/flask/
  Could not fetch URL https://pypi.org/simple/flask/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/flask/ (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1076)'))) - skipping
  Could not find a version that satisfies the requirement Flask (from versions: )
No matching distribution found for Flask
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:1076)'))) - skipping

(venv) C:\Users\מחשב\Documents\pyton\myproject>

2 个答案:

答案 0 :(得分:0)

从pypi下载软件包时,好像有SSL认证错误:

  

无法获取URL https://pypi.org/simple/pip/:确认ssl证书时出现问题:HTTPSConnectionPool(host ='pypi.org',port = 443):

您可以尝试将pypi添加为受信任的主机并重新安装吗?类似于:

pip install --trusted-host pypi.python.org flask 

希望有帮助!

答案 1 :(得分:0)

最后我找到了一个句子  --trusted-host files.pythonhosted.org --trusted-host pypi.org --trusted-host pypi.python.org 这项工作! 当您在计算机上进行阻止时,需要在需要的库之前删除安全性

pip install --trusted-host files.pythonhosted.org --trusted-host pypi.org --trusted-host pypi.python.org Flask