1、问题一直安装失败
(.venv) PS D:\python-code\pythonProject1\pythonProject1> pip install flask
Looking in indexes: https://mirrors.aliyun.com/pypi/simple/
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', timeout('_ssl.c:1059: The handshake operation timed out'))': /pypi/simple/flask/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', timeout('_ssl.c:1059: The handshake operation timed out'))': /pypi/simple/flask/
2、镜像地址修改成阿里云
(.venv) PS D:\python-code\pythonProject1\pythonProject1> pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/
Writing to C:\Users\Administrator\AppData\Roaming\pip\pip.ini
(.venv) PS D:\python-code\pythonProject1\pythonProject1> pip config list
global.index-url='https://mirrors.aliyun.com/pypi/simple/'
(.venv) PS D:\python-code\pythonProject1\pythonProject1>
3、SSL 证书验证失败
根据你提供的输出,看起来你在使用阿里云的镜像地址时遇到了 SSL 证书验证失败的问题。这通常是由于缺少根证书或证书验证配置不正确导致的。
你可以尝试以下解决方法之一:
- 忽略 SSL 证书验证:在使用 pip 安装包时,可以添加
--trusted-host
参数来忽略 SSL 证书验证。例如:
pip install --trusted-host mirrors.aliyun.com Flask
这将会忽略对镜像地址的 SSL 证书验证。
-
更新证书:确保你的操作系统上的根证书是最新的。你可以尝试更新操作系统的根证书,然后再次尝试使用阿里云的镜像地址。
-
修改镜像地址:如果以上方法都无效,你可以尝试切换到其他镜像地址,比如使用官方的 PyPI 镜像地址:
pip config set global.index-url https://pypi.org/simple/
这将会将全局的 pip 镜像地址设置为官方的 PyPI 镜像地址,可能会解决 SSL 证书验证失败的问题。
尝试以上方法中的一个,看看是否能够解决你遇到的问题。如果问题仍然存在或者有其他疑问,请随时告诉我!