python3使用pip安装pyautogui过程中遇到的几个问题

最近想要做一个模拟鼠标点击的小程序(具体原因不说了哈:)),就想到使用python,上网搜了一下,很多都使用pyautogui这个库的,于是就想要安装pyautogui,但是过程中遇到了几个坑,写此博记录一下,当然也很高兴可以为看到此博的你解决同样的问题。

先写一下自己的环境:操作系统windows7 64位,python版本python-3.7.0-amd64,安装方式pip。OK,下面就开始逐条列举所遇问题及解决方法。

1.运行pip install pyautogui后出现如下错误(黄字):

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 https://pypi.org/simple/pyautogui/: There was a problem co
nfirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', 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 https://pypi.org/simple/pip/: There was a problem confirming
 the ssl certificate: HTTPSConnectionPool(host='pypi.org', 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

这个问题比较坑,看log应该是https鉴权,于是上网找了各种方法,都不行,重装python,重启电脑,修改电脑时间都不行,最后发现是自己在调式其他东西打开了fiddler,关闭fiddler就好了,这个是被自己坑了。

 

2.继续运行pip install pyautogui后提示You are using pip version 10.0.1, however version 19.0.1 is available.

这个是pip版本低了,根据提示运行python -m pip install --upgrade pip即可。

 

3.继续运行pip install pyautogui出现错误:

  Using cached https://files.pythonhosted.org/packages/01/ed/56d4a369c6e18f6b239
d9ef37b3222ba308bfebf949571b2611ff7d64f1d/PyGetWindow-0.0.4.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "", line 1, in
      File "C:\Users\80237102\AppData\Local\Temp\pip-install-m1k3v484\pygetwindo
w\setup.py", line 11, in
        long_description = fh.read()
    UnicodeDecodeError: 'gbk' codec can't decode byte 0xa2 in position 905: ille
gal multibyte sequence

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\80237102
\AppData\Local\Temp\pip-install-m1k3v484\pygetwindow\

这个错误是安装pyautogui过程中遇到的一个核心错误,是安装PyGetWindow过程中出现的,网上搜了一通,最后试了各种方法,就是降低PyGetWindow版本,默认安装的PyAutoGUI-0.9.41,依赖的是PyGetWindow-0.0.4,就是这个PyGetWindow-0.0.4导致了上述问题,于是网上大神说降低PyGetWindow版本,运行pip install PyGetWindow==0.0.1后安装PyGetWindow成功,然后再运行pip install pyautogui,这次,欧耶,成功了。

你可能感兴趣的:(python)