窗口命令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. lodop 二维码内容多少

    QRCode最多能放181个汉字:LODOP.ADD_PRINT_BARCODE(248,6,60,60,"QRCode","一二三四五六七八九十二二三四五六七八九十三二 ...

  2. 【Java】数组使用

    package aaa; public class aaa { public static void main(String args[]) { int a[]={1,2,3,4}; for(int ...

  3. Linux学习之CentOS(三)----将Cent0S 7的网卡名称eno16777736改为eth0

    [声明] 欢迎转载,但请保留文章原始出处→_→ 生命壹号:http://www.cnblogs.com/smyhvae/ 文章来源:http://www.cnblogs.com/smyhvae/p/3 ...

  4. Vue2学习笔记:数据交互vue-resource

    基本语法 必须引入一个库:vue-resource github地址 // 基于全局Vue对象使用http Vue.http.get('/someUrl', [options]).then(succe ...

  5. extjs 可视化开发工具

    不清楚Ext可视化的可以看一下http://www.screencast.com/users/JackSlocum这里的三个视频哈. 安装和汉化的步骤 第一步下载:Ext需要支持AIR的支持 下载并安 ...

  6. .Linode服务器的使用 网站迁移

    很多建站的朋友习惯了虚拟主机的 Cpanel 面板,但是面对 VPS 都感觉无所适从.毕竟外贸人很少接触到这类知识,所以需要一个贴心的新手教程. Linode VPS:国外最好的VPS注册购买教程 撇 ...

  7. redis 配置文件redis.conf

    daemonize yes #---默认值no,该参数用于定制redis服务是否以守护模式运行.--- pidfile /var/run/redis.pid #默认值/var/run/redis.pi ...

  8. Mac OS X 10.9 Mavericks 无法启动 WebStorm(PhpStorm)

    手滑把Mac的系统升到了10.9,结果机子上的PhpStorm6.0启动不了. 十分天真的重装了一次PhpStorm,问题依然没有修复. 开始怨念苹果的这次升级,毕竟以往的升级都是无缝的,升级OS就应 ...

  9. EOS资料收集

    柚子(EOS)可以理解为Enterprise Operation System,即为商用分布式应用设计的一款区块链操作系统.EOS是EOS软件引入的一种新的区块链架构,旨在实现分布式应用的性能扩展.注 ...

  10. chrome的uget扩展程序红色 Unable to connect with uget-integrator问题

    我们根据网上的教程在ubuntu16.04中安装下载工具uget+aria2并配置chrome时,最后重新打开chrome浏览器,发现uget扩展程序是红色的,点开看到”Unable to conne ...