python抠图与pip install PIL报错
窗口命令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报错的更多相关文章
- Win10 pip install gensim 报错处理
# 故障描述 shell > pip install gensim # 报错信息如下: Command "c:\users\op\appdata\local\programs\pyth ...
- 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 (参考 ...
- centos 7 pip install MySQL-python 报错
pip install MySQL-python 报错 pip install MySQL-python DEPRECATION: Python . Please upgrade your Pytho ...
- pip install python-igraph 报错,C core of igraph 没有安装。
(一)问题描述 Centos7 安装python-igraph时,pip install python-igraph 报错,C core of igraph 没有安装. failure: repoda ...
- Python中pip install MySQL-python报错解决方法
环境 Centos 7(其他Centos或者RHEL一样) 问题 在执行 pip install MySQL-python 时报错如: Command "python setup.py eg ...
- pip install xxxx报错(一大堆红色exception)【解决】
安装个distribute或nose或lpthw.web或virtualenv 都可能出现下面问题 root@kali:~# pip install distribute Collecting d ...
- pip install locustio报错
安装locust时, 执行pip install locustio时报错 ERROR: Cannot uninstall 'requests'. It is a distutils installed ...
- python安装matplotlib:python -m pip install matplotlib报错
matplotlib是python中强大的画图模块. 首先确保已经安装python,然后用pip来安装matplotlib模块. 进入到cmd窗口下,建议执行python -m pip install ...
- python pip install mysql-python报错
报错: 下载地址: https://www.lfd.uci.edu/~gohlke/pythonlibs/#mysql-python
随机推荐
- linux erlang环境安装
1.安装环境:yum -y install make gcc gcc-c++ kernel-devel m4 glibc-devel autoconfyum -y install ncurses-de ...
- jsonp 返回以前必须要再转一次json
public static void main(String[] args) { String ajaxJsonStr = null; AjaxJson ajaxJson ...
- zookeeper应用 - 配置服务
一端不停的更新配置,另一端监听这个配置的变化. 需要注意的是:监听端不一定读取到所有的变化.在zk服务器发送通知到客户端,客户端读取数据注册监听之间可能发生了多次数据变化,这些数据变化是得不到 ...
- 【Java】得到当前系统时间,精确到毫秒
import java.text.SimpleDateFormat; import java.util.Date; import java.util.Calendar; public class Ma ...
- 4.Servlet过滤器
1.Servlet 编写过滤器 Servlet 过滤器是可用于 Servlet 编程的 Java 类,有以下目的: 在客户端的请求访问后端资源之前,拦截这些请求. 在服务器的响应发送回客户端之前,处理 ...
- 5.FileWriter 和 BufferWriter
FileWriter 和 BufferWriter的使用场景 IO这块,各种Writer,Reader,让人眼晕 而在网上基本找不到在什么时候用哪个类,并且网上的IO demo 很多用法都是错的 在 ...
- Oracle EBS 查看请求执行情况
SELECT s.* FROM fnd_concurrent_requests r, v$session v, v$sql s WHERE r.oracle_session_id = v.audsid ...
- 全局唯一ID生成器
分布式环境中,如何保证生成的id是唯一不重复的? twitter,开源出了一个snowflake算法,现在很多企业都按照该算法作为参照,实现了自己的一套id生成器. 该算法的主要思路为: 刚好64位的 ...
- [翻译] LiquidFloatingActionButton
LiquidFloatingActionButton https://github.com/yoavlt/LiquidFloatingActionButton LiquidFloatingAction ...
- Linux学习之路-2017/12/25
三章 命令通配符 .PATH变量 支持多种文本的通配符 通配符 含义 * 匹配零个或多个字符 ? 匹配任意单个字符 [0-9] 匹配范围内的数字 [ ...