python3中启动uiautomator2viewer时报错解决办法
事先说明:我电脑⾥同时了安装了 python2和python3,启动对应版本时分别带上版本号,如何设置共存请参考:
打开命令窗⼝,启动weditor : python3 -m weditor,报如下错误:
1 C:\Windows\system32>python3 -m weditor
2 Traceback (most recent call last):
3  File "C:\Program Files\Python37\lib\runpy.py", line 193, in _run_module_as_main
4"__main__", mod_spec)
5  File "C:\Program Files\Python37\lib\runpy.py", line 85, in _run_code
6exec(code, run_globals)
7  File "C:\Program Files\Python37\lib\site-packages\weditor\__main__.py", line 19, in <module>
8import StringIO
9 ModuleNotFoundError: No module named 'StringIO'
查阅了⼀下别⼈博客说明,在Python3中没有直接通过 import StringIO的⽅法(在python2中使⽤),正确的使⽤⽅法为 from io import StringIO,根据上⾯错误输出中的解决办法,到 C:\Program Files\Python37\Lib\site-packages\weditor 将 “__main__.py” ⽂件中第19⾏修改为 from io import StringIO (我是重新新增⼀⾏,把原语句注释掉)
数组中的元素能重新赋值吗再次运⾏ Python3 -m weditor 时,还是报错,不过是报另外⼀个错,说明上⾯的问题已经解决,下⾯来看看第⼆个错是什么样的,提⽰没有 cv2模块程序设计语言的基本功能包括
1 C:\Windows\system32>python3 -m weditor
2 Traceback (most recent call last):
3  File "C:\Program Files\Python37\lib\runpy.py", line 193, in _run_module_as_main
4"__main__", mod_spec)this is us好看吗
5  File "C:\Program Files\Python37\lib\runpy.py", line 85, in _run_code
6exec(code, run_globals)
7  File "C:\Program Files\Python37\lib\site-packages\weditor\__main__.py", line 24, in <module>
电脑python安装教程8import atx
9  File "C:\Program Files\Python37\lib\site-packages\atx\__init__.py", line 22, in <module>
10from atx.drivers import Pattern, Bounds, ImageCrop
11  File "C:\Program Files\Python37\lib\site-packages\atx\drivers\__init__.py", line 9, in <module>
12from atx import imutils
13  File "C:\Program Files\Python37\lib\site-packages\atx\imutils.py", line 16, in <module>
14import cv2
15 ModuleNotFoundError: No module named 'cv2'
conversionpattern那就再安装 cv2模块,不过这个模块的安装⽅法跟其它模块有点不⼀样,不能直接通过名字的形式去猜测安装⽅法,⼀般⼈都是直接 pip3 install cv2,结果会发现这个⾏不通,通过查阅其它⼈博客,该cv2 模块的正确安装⽅法是 pip3 install opencv-python
1 C:\Windows\system32>pip3 install opencv-python
2 Collecting opencv-python
3  Downloading /packages/82/de/32bdf7b20f9d08008dda2073a48141ab4ad829deaca7aa660e9c64d02dae/opencv_python-3.4.3.18-cp37-cp37m-win_amd64.whl (33.8MB)
4    100% |████████████████████████████████| 33.8MB 280kB/s
5 Requirement already satisfied: numpy>=1.14.5 in c:\program files\python37\lib\site-packages (from opencv-python) (1.15.1)
6 Installing collected packages: opencv-python
7 Successfully installed opencv-python-3.4.3.18
再次启动 python3 -m weditor,⽹页版的 uiautomatorviewer 正常打开
1 C:\Windows\system32>python3 -m weditor
二分法c语言
2 listen port 17310
3 [I 180910 10:29:11 web:2162] 30
4 GET /api/v1/version (::1) 0.00ms
4 [I 180910 10:29:1
5 web:2162] 200 POST /api/v1/connect (::1) 828.14ms
5 SN 55115076-099d-4f9c-b11a-8ada31375c5e
6 [I 180910 10:29:29 web:2162] 200 GET /api/v1/devices/55115076-099d-4f9c-b11a-8ada31375c5e/screenshot (::1) 1092.94ms
7 [I 180910 10:29:30 web:2162] 200 GET /api/v1/devices/55115076-099d-4f9c-b11a-8ada31375c5e/hierarchy (::1) 724.49ms

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。