(venv) user1@imooc:~/u2_project$ pip install uiautomator2 -i https://pypi.douban.com/simple/
后提示:
Successfully installed Deprecated-1.2.13 Pillow-8.4.0 adbutils-1.2.1 apkutils2-1.0.0 cached-property-1.5.2 certifi-2022.12.7 charset-normalizer-2.0.12 cigam-0.0.3 decorator-5.1.1 deprecation-2.1.0 filelock-3.4.1 idna-3.4 logzero-1.7.0 lxml-4.9.2 packaging-20.9 progress-1.6 py-1.11.0 pyelftools-0.29 pyparsing-3.0.9 requests-2.27.1 retry-0.9.2 six-1.16.0 uiautomator2-2.16.22 urllib3-1.26.13 whichcraft-0.6.1 wrapt-1.14.1 xmltodict-0.13.0
但是运行 uiautomator2 --version,就已经报错了,说明uiautomator2并没安装成功吗?
Traceback (most recent call last):
File “/home/user1/u2_project/venv/bin/uiautomator2”, line 5, in
from uiautomator2.main import main
File “/home/user1/u2_project/venv/lib/python3.6/site-packages/uiautomator2/init.py”, line 40, in
import adbutils
File “/home/user1/u2_project/venv/lib/python3.6/site-packages/adbutils/init.py”, line 12, in
from ._adb import AdbConnection
File “/home/user1/u2_project/venv/lib/python3.6/site-packages/adbutils/_adb.py”, line 19, in
from ._proto import *
File “/home/user1/u2_project/venv/lib/python3.6/site-packages/adbutils/_proto.py”, line 15, in
from dataclasses import dataclass
ModuleNotFoundError: No module named ‘dataclasses’
急急急!!!!该如何解决,请老师解答一下。
翻看了一下其他人也有类似的问题,开始我也以为是python -m uiautomator2 init出错,其实是uiautomator2 --version就运行不了。