Recently, I wanted to make a mini program that simulates mouse clicks (I won’t talk about the specific reason:)), so I thought of using python. I searched online and many of them were used.pyautoguiI want to install pyautogui for this library, but I encountered several pitfalls during the process. I wrote this blog to record it. Of course, I am very happy to solve the same problem for you who see this blog.
Write about your own environment first: operating systemwindows764-bit, python version python-3.7.0-amd64, installation methodpip. OK, let’s start listing the problems encountered and solutions one by one.
1. After running pip install pyautogui, the following error (yellow word):
Collecting pyautogui
Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None))
after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFI
CATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certif
icate (_ssl.c:1045)'))': /simple/pyautogui/
Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None))
after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFI
CATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certif
icate (_ssl.c:1045)'))': /simple/pyautogui/
Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None))
after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFI
CATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certif
icate (_ssl.c:1045)'))': /simple/pyautogui/
Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None))
after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFI
CATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certif
icate (_ssl.c:1045)'))': /simple/pyautogui/
Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None))
after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFI
CATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certif
icate (_ssl.c:1045)'))': /simple/pyautogui/
Could not fetch URL /simple/pyautogui/: There was a problem co
nfirming the ssl certificate: HTTPSConnectionPool(host='', port=443): Ma
x retries exceeded with url: /simple/pyautogui/ (Caused by SSLError(SSLCertVerif
icationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: una
ble to get local issuer certificate (_ssl.c:1045)'))) - skipping
Could not find a version that satisfies the requirement pyautogui (from versio
ns: )
No matching distribution found for pyautogui
Could not fetch URL /simple/pip/: There was a problem confirming
the ssl certificate: HTTPSConnectionPool(host='', port=443): Max retrie
s exceeded with url: /simple/pip/ (Caused by SSLError(SSLCertVerificationError(1
, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get loc
al issuer certificate (_ssl.c:1045)'))) - skipping
This problem is quite tricky. I saw that the log should be https authentication, so I searched for various methods online, but they didn't work. I reinstalled python, restarted the computer, and modified the computer time. Finally, I found that I was opening other things in the mode.fiddler, just close the fiddler, this is something I've cheated on.
2. After continuing to run pip install pyautogui, you are using pip version 10.0.1, however version 19.0.1 is available.
This is the pip version is low. Just run python -m pip install --upgrade pip according to the prompts.
3. The error occurred when continuing to run pip install pyautogui:
Using cached /packages/01/ed/56d4a369c6e18f6b239
d9ef37b3222ba308bfebf949571b2611ff7d64f1d/PyGetWindow-0.0.
Complete output from command python egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\80237102\AppData\Local\Temp\pip-install-m1k3v484\pygetwindo
w\", line 11, in <module>
long_description = ()
UnicodeDecodeError: 'gbk' codec can't decode byte 0xa2 in position 905: ille
gal multibyte sequence
----------------------------------------
Command "python egg_info" failed with error code 1 in C:\Users\80237102
\AppData\Local\Temp\pip-install-m1k3v484\pygetwindow\
This error is a core error encountered during the installation of pyautogui. It appeared during the installation of PyGetWindow. I searched online and finally tried various methods, which is to reduce the PyGetWindow version. The default installation of PyAutoGUI-0.9.41 depends on PyGetWindow-0.0.4. This is the PyGetWindow-0.0.4 that caused the above problems. So the master online said that it would reduce the PyGetWindow version, run pip install PyGetWindow==0.0.1 and then run pip install pyautogui. This time, Ouye, it was successful.