窗口命令pip install PIL(python3.6+selenium——2.53.1+pycharm)

from PIL import Image

from selenium import webdriver
d=webdriver.Firefox()
d.get('http://www.baidu.com')
# 窗口最大化
d.maximize_window()
time.sleep(1)
# 进行全屏截图
d.get_screenshot_as_file('c:\mark666.png')
# 定位需要截图的元素位置
baidu=d.find_element('id','su')
# 获取element的顶点坐标
left=baidu.location['x']
top=baidu.location['y']
# 获取element的宽、高
elementwidth=baidu.location['x']+baidu.size['width']
elementheight=baidu.location['y']+baidu.size['height']
# 打开截图
p=Image.open('c:\mark666.png')
# 使用Image的crop函数,从截图中再次截取我们需要的区域,进行图片剪切
p=p.crop((left,top,elementwidth,elementheight))
# 保存我们需要的的图片
p.save(r'c:\mark6.png')


https://www.cnblogs.com/yuanzhoulvpi/p/9028713.html(导入pip install PIL报错参考)  可能是我进行了多次的安装和卸载,我在找着pip后输入pip install PIL报错:

could not find a version that satisfies the requirement PIL    no matching distribution found for PIL找着个说要下载pillow,下载进行安装报错,然后就在DOS找着pip的目录下输入pip install wheel ,把下载的Pillow‑5.1.1‑cp36‑cp36m‑win_amd64.whl
拖到C:\Users\Administrator\AppData\Local\Programs\Python\Python36\Scripts 安装python目录的scripts文件夹里,最后在DoS窗口
找着pip的目录下输入pip install PIL就成功了。 (多次进行安装卸载selenium可能出现这个问题)
												

python抠图与pip install PIL报错的更多相关文章

  1. Win10 pip install gensim 报错处理

    # 故障描述 shell > pip install gensim # 报错信息如下: Command "c:\users\op\appdata\local\programs\pyth ...

  2. pip install mysql-python报错1. Unable to find vcvarsall.bat 2 fatal error C1083: Cannot open include file: 'config-win.h': No such file or directory 3.error: command 'mt.exe' failed with exit statu

    最近在安装mysql -python 时报错折腾了半天,通过以下方法解决: 1. pip install mysql-python报错 Unable to find vcvarsall.bat (参考 ...

  3. centos 7 pip install MySQL-python 报错

    pip install MySQL-python 报错 pip install MySQL-python DEPRECATION: Python . Please upgrade your Pytho ...

  4. pip install python-igraph 报错,C core of igraph 没有安装。

    (一)问题描述 Centos7 安装python-igraph时,pip install python-igraph 报错,C core of igraph 没有安装. failure: repoda ...

  5. Python中pip install MySQL-python报错解决方法

    环境 Centos 7(其他Centos或者RHEL一样) 问题 在执行 pip install MySQL-python 时报错如: Command "python setup.py eg ...

  6. pip install xxxx报错(一大堆红色exception)【解决】

    安装个distribute或nose或lpthw.web或virtualenv 都可能出现下面问题   root@kali:~# pip install distribute Collecting d ...

  7. pip install locustio报错

    安装locust时, 执行pip install locustio时报错 ERROR: Cannot uninstall 'requests'. It is a distutils installed ...

  8. python安装matplotlib:python -m pip install matplotlib报错

    matplotlib是python中强大的画图模块. 首先确保已经安装python,然后用pip来安装matplotlib模块. 进入到cmd窗口下,建议执行python -m pip install ...

  9. python pip install mysql-python报错

    报错: 下载地址: https://www.lfd.uci.edu/~gohlke/pythonlibs/#mysql-python

随机推荐

  1. JSON学习笔记-5

    JSON.parse() 1.从服务器接受数据进行解析(一般是字符串) 2.解析前要确保你的数据是标准的 JSON 格式,否则会解析出错.可以使用线工具检测:https://c.runoob.com/ ...

  2. owin Claims-based认证登录实现

    public override async Task GrantResourceOwnerCredentials(OAuthGrantResourceOwnerCredentialsContext c ...

  3. webstorm忽略node_modules目录

    我在使用了cnpm后node_modules之前的层级目录变成了同一级目录,所以目录很多,造成webstorm读取时卡死. 网上大家列了各种方法,在这里我归纳一下! 先给大家看看一些相关链接. 方法1 ...

  4. 初识oracle重做日志文件

    转自 http://blog.csdn.net/indexman/article/details/7746948 以下易容翻译自oracle dba官方文档,不足之处还望指出. 管理重做日志文件 学习 ...

  5. 回归JavaScript基础(五)

    主题:介绍引用类型Object.Array. 在上一章中,作者就在说变量的值的时候,提到过引用类型这个概念.JavaScript中存在基本类型和引用类型,其中引用类型很重要,这里有许多我们需要注意的东 ...

  6. webpack HMR是如何工作的?

    https://github.com/webpack/docs/wiki/hot-module-replacement-with-webpack https://www.jianshu.com/p/9 ...

  7. Oracle EBS AR 删除应收发票

    DECLARE    -- Non-scalar parameters require additional processing     p_errors arp_trx_validate.mess ...

  8. [CENTOS7] 加入Windows域

    This following article is a snapshot from: https://www.rootusers.com/how-to-join-centos-linux-to-an- ...

  9. POST请求上传多张图片并携带参数

    POST请求上传多张图片并携带参数 在iOS中,用POST请求携带参数上传图片是非常恶心的事情,HTTPBody部分完全需要我们自己来配置,这个HTTPBody分为3个部分,头部分可以携带参数,中间部 ...

  10. [控件] TranformFadeView

    TranformFadeView 效果图: 源码地址: https://github.com/YouXianMing/UI-Component-Collection 注意: maskView是iOS8 ...