Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/321.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/macos/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
pythonvirtualenv中的SSLError_Python_Macos_Ssl_Virtualenv - Fatal编程技术网

pythonvirtualenv中的SSLError

pythonvirtualenv中的SSLError,python,macos,ssl,virtualenv,Python,Macos,Ssl,Virtualenv,我已经通过macOS上的awscli virtualenv安装了python。当我尝试启动awscli时,出现SSL错误: 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

我已经通过macOS上的awscli virtualenv安装了python。当我尝试启动awscli时,出现SSL错误:

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("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping
当我尝试在virtualenv中重新安装python或awscli时,我会遇到相同的错误。 以下是当前的Python和pip版本:

~$ which python
/Users/roksolana/.virtualenvs/awscli/bin/python

~$ python --version
Python 3.7.4

~$ which pip
/Users/roksolana/.virtualenvs/awscli/bin/pip

~$ pip --version
pip 19.2.1 from /Users/roksolana/.virtualenvs/awscli/lib/python3.7/site-packages/pip (python 3.7)
OpenSSL安装在我的macOS上。
如何解决此问题?

尝试在不安装pip的情况下安装pip。这一问题已得到报告,也得到了解决

安装curl(如果系统上没有),然后运行:

curlhttps://bootstrap.pypa.io/get-pip.py |蟒蛇

您是从源代码构建python还是编写python?我是从源代码安装的。您的python安装似乎不完整。在安装依赖项后,您必须重新生成(生成和生成安装)。尝试安装依赖项,如(brew安装)libffi、libssl、zlib1g、libncurses5、libncursesw5、libreadline、libsqlite3。确保在配置(./configure--enable optimizations)源时启用优化。如果您想节省一些时间,只需编写它。这很奇怪,因为自从Python安装以来(6个月前),我没有遇到任何问题。我不明白什么会改变并导致此错误当我尝试运行curl时,我会收到相同的错误消息和此警告:
警告:在连接被'SSLError'断开后重试(重试(总计=0,连接=None,读取=None,重定向=None,状态=None)(“无法连接到HTTPS URL,因为SSL模块不可用。”)':/simple/pip/
所以我甚至不能重新安装它。这对你有用吗
pip安装--升级pip--trusted host pypi.org--trusted host files.pythonhosted.org
如果它安装了,那么您的
ssl证书将得到更新。