无法使用 pip 安装软件包(ssl 错误)
Posted
技术标签:
【中文标题】无法使用 pip 安装软件包(ssl 错误)【英文标题】:cant install package with pip (ssl error) 【发布时间】:2022-01-08 08:03:32 【问题描述】:我试图再次安装 pywhatkit。它由于某种原因停止工作。我也试过了
pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host files.pythonhosted.org pywhatkit
但我只得到这个:
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:748)'),)': /simple/pywhatkit/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:748)'),)': /simple/pywhatkit/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:748)'),)': /simple/pywhatkit/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:748)'),)': /simple/pywhatkit/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:748)'),)': /simple/pywhatkit/
Could not fetch URL https://pypi.org/simple/pywhatkit/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pywhatkit/ (Caused by SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:748)'),)) - skipping
ERROR: Could not find a version that satisfies the requirement pywhatkit (from versions: none)
ERROR: No matching distribution found for pywhatkit
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(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:748)'),)) - skipping
【问题讨论】:
【参考方案1】:对PyPi 的简单搜索表明pywhatkit
可以通过简单的pip install
获得:
$ pip install pywhatkit
Collecting pywhatkit
Downloading pywhatkit-5.2-py3-none-any.whl (11 kB)
Collecting wikipedia
Downloading wikipedia-1.4.0.tar.gz (27 kB)
Collecting requests
Using cached requests-2.26.0-py2.py3-none-any.whl (62 kB)
Collecting pyautogui
Downloading PyAutoGUI-0.9.53.tar.gz (59 kB)
|████████████████████████████████| 59 kB 1.3 MB/s
Collecting Pillow
Downloading Pillow-8.4.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.1 MB)
|████████████████████████████████| 3.1 MB 3.6 MB/s
Collecting pymsgbox
Downloading PyMsgBox-1.0.9.tar.gz (18 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing wheel metadata ... done
Collecting PyTweening>=1.0.1
Downloading pytweening-1.0.4.tar.gz (14 kB)
Collecting pyscreeze>=0.1.21
Downloading PyScreeze-0.1.28.tar.gz (25 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing wheel metadata ... done
Collecting pygetwindow>=0.0.5
Downloading PyGetWindow-0.0.9.tar.gz (9.7 kB)
Collecting mouseinfo
Downloading MouseInfo-0.1.3.tar.gz (10 kB)
Collecting python3-Xlib
Downloading python3-xlib-0.15.tar.gz (132 kB)
|████████████████████████████████| 132 kB 6.7 MB/s
Collecting pyrect
Downloading PyRect-0.1.4.tar.gz (15 kB)
Collecting pyperclip
Downloading pyperclip-1.8.2.tar.gz (20 kB)
Collecting idna<4,>=2.5
Using cached idna-3.3-py3-none-any.whl (61 kB)
Collecting certifi>=2017.4.17
Using cached certifi-2021.10.8-py2.py3-none-any.whl (149 kB)
Collecting charset-normalizer~=2.0.0
Using cached charset_normalizer-2.0.8-py3-none-any.whl (39 kB)
Collecting urllib3<1.27,>=1.21.1
Using cached urllib3-1.26.7-py2.py3-none-any.whl (138 kB)
Collecting beautifulsoup4
Downloading beautifulsoup4-4.10.0-py3-none-any.whl (97 kB)
|████████████████████████████████| 97 kB 3.9 MB/s
Collecting soupsieve>1.2
Downloading soupsieve-2.3.1-py3-none-any.whl (37 kB)
Using legacy 'setup.py install' for pyautogui, since package 'wheel' is not installed.
Using legacy 'setup.py install' for pygetwindow, since package 'wheel' is not installed.
Using legacy 'setup.py install' for PyTweening, since package 'wheel' is not installed.
Using legacy 'setup.py install' for mouseinfo, since package 'wheel' is not installed.
Using legacy 'setup.py install' for pyperclip, since package 'wheel' is not installed.
Using legacy 'setup.py install' for pyrect, since package 'wheel' is not installed.
Using legacy 'setup.py install' for python3-Xlib, since package 'wheel' is not installed.
Using legacy 'setup.py install' for wikipedia, since package 'wheel' is not installed.
Building wheels for collected packages: pyscreeze, pymsgbox
Building wheel for pyscreeze (PEP 517) ... done
Created wheel for pyscreeze: filename=PyScreeze-0.1.28-py3-none-any.whl size=13023 sha256=be44863ae17e02773581159a11ca3a39dbc3825f5b67f53f115866e48cf8b5dc
Stored in directory: /home/username/.cache/pip/wheels/03/86/12/abd9680f6f63999ec0433afdbca9d26201eae26247bbbfb3a8
Building wheel for pymsgbox (PEP 517) ... done
Created wheel for pymsgbox: filename=PyMsgBox-1.0.9-py3-none-any.whl size=7420 sha256=90e67efa02c85831b532a212e8777fd1b82f70047ea45028e01eadfb4b905b99
Stored in directory: /home/username/.cache/pip/wheels/b9/6a/ba/be2d7d78166ec8018c21d07241dffa54446c09652a267759ae
Successfully built pyscreeze pymsgbox
Installing collected packages: urllib3, soupsieve, python3-Xlib, pyrect, pyperclip, idna, charset-normalizer, certifi, requests, PyTweening, pyscreeze, pymsgbox, pygetwindow, mouseinfo, beautifulsoup4, wikipedia, pyautogui, Pillow, pywhatkit
Running setup.py install for python3-Xlib ... done
Running setup.py install for pyrect ... done
Running setup.py install for pyperclip ... done
Running setup.py install for PyTweening ... done
Running setup.py install for pygetwindow ... done
Running setup.py install for mouseinfo ... done
Running setup.py install for wikipedia ... done
Running setup.py install for pyautogui ... done
Successfully installed Pillow-8.4.0 PyTweening-1.0.4 beautifulsoup4-4.10.0 certifi-2021.10.8 charset-normalizer-2.0.8 idna-3.3 mouseinfo-0.1.3 pyautogui-0.9.53 pygetwindow-0.0.9 pymsgbox-1.0.9 pyperclip-1.8.2 pyrect-0.1.4 pyscreeze-0.1.28 python3-Xlib-0.15 pywhatkit-5.2 requests-2.26.0 soupsieve-2.3.1 urllib3-1.26.7 wikipedia-1.4.0
您在尝试安装pywhatkit
时使用的是哪个操作系统和哪个版本的pip
?
【讨论】:
我使用的是 Windows 11 和 pip 版本 21.3.1。从前几天开始,由于 ssl 错误,我无法安装任何软件包。以上是关于无法使用 pip 安装软件包(ssl 错误)的主要内容,如果未能解决你的问题,请参考以下文章
python2和python3 在windows下公用 导致python2 pip无法使用 报ssl的错误
关于windows下 使用Anaconda3安装的python无法使用ssl模块问题.关联pip无法下载https
无法在 Python3、Ubuntu14.04 中使用 pip 安装 NumPy