问题现象
在cmd命令中输入python -m pip install –upgrade pip报WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available
xxx@xxx:~/code/xx/OpenHarmony-v3.2-Beta5$ /xx/xx/xx/xx/OpenHarmony-v3.2-Beta5/prebuilts/python/linux-x86/3.9.2/bin/python3.9 -m pip install --trusted-host pypi.org --upgrade pip
WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/pip/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/pip/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/pip/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/pip/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/pip/
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
Requirement already up-to-date: pip in ./prebuilts/python/linux-x86/3.9.2/lib/python3.9/site-packages (20.2.3)
解决方案
这个问题是一个鸡生蛋生鸡的问题,所以只能手动下载pip进行升级。
sudo curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
sudo chmod 777 get-pip.py
python3 get-pip.py