窗口命令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. UltraPtr下拉刷新

    github:  https://github.com/liaohuqiu/android-Ultra-Pull-To-Refresh <in.srain.cube.views.ptr.PtrF ...

  2. 结对作业——随机生成四则运算(Core 第7组)

    结对作业 ——随机生成四则运算(core第7组) 吕佳玲 PB16060145 涂涵越 PB16060282 GITHUB地址 https://github.com/hytu99/homework_2 ...

  3. SSH安全

    新建用户,设置密码 useradd eason passwd eason 不允许root直接登陆 修改配置文件 vi /etc/ssh/sshd_config 禁止root登录 查找“#PermitR ...

  4. [EntityFramework] 对 DateTime 类型使用 SQL 服务器时间或者字段默认值

    DateTime 类型在 SQL 服务器上如果设置了默认值,在 EntityFramework 添加新行的时候想使用该默认值,则不能对新增加的实体的 DateTime 字段赋值. 但是如果新增加的实体 ...

  5. Civil War

    Civil War 编辑 <Civil War>是美国硬摇滚乐队枪炮与玫瑰的一首单曲,首次收录于1990年的群星慈善专辑<Nobody's Child: Romanian Angel ...

  6. VRSProcess(一)

    1.freopen( "CONOUT$","w",stdout);在操作系统中,命令行控制台(即键盘或者显示器)被视为一个文件,既然是文件,那么就有“文件名”. ...

  7. JXL API总结

    API参考: http://www.andykhan.com/jexcelapi/index.html 官网: http://jexcelapi.sourceforge.net/ 1. 创建可写的工作 ...

  8. 关于elasticsearch 6.x及其插件head安装(单机与集群)5分钟解决

    第一步,下载es6 +head wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.3.2.zip wg ...

  9. Smarty常用函数

    1 .include_once语句: 引用文件路径,路径必需正确.   eg:include_once("smarty/Smarty.class.php"); 2 $smarty= ...

  10. golang第三方库goconfig的使用

    参考地址:​http://studygolang.com/articles/818 详细的解析可以看上面链接,这里只做一点简单介绍 先安装好包,然后导入 import (    "githu ...