airtest报错ModuleNotFoundError: No module named ‘poco‘解决记录

问题描述

在执行airtest测试脚本时,一直提示报错ModuleNotFoundError: No module named ‘poco’

Traceback:
/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/_pytest/python.py:608: in _importtestmodule
    mod = import_path(self.path, mode=importmode, root=self.config.rootpath)
/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/_pytest/pathlib.py:533: in import_path
    importlib.import_module(module_name)
/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
:1050: in _gcd_import
    ???
:1027: in _find_and_load
    ???
:1006: in _find_and_load_unlocked
    ???
:688: in _load_unlocked
    ???
/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/_pytest/assertion/rewrite.py:168: in exec_module
    exec(co, module.__dict__)
test_hello.py:13: in 
    from poco.exceptions import *
E   ModuleNotFoundError: No module named 'poco'

而尝试用pip3 install poco安装时,又提示报如下错误:

Collecting poco
  Using cached poco-0.98.1.tar.gz (34 kB)
  Preparing metadata (setup.py) ... done
Collecting pyyaml==3.13
  Using cached PyYAML-3.13.tar.gz (270 kB)
  Preparing metadata (setup.py) ... done
Collecting pyaml==18.11.0
  Using cached pyaml-18.11.0-py2.py3-none-any.whl (16 kB)
Collecting svn==0.3.46
  Using cached svn-0.3.46.tar.gz (12 kB)
  Preparing metadata (setup.py) ... done
Collecting gitpython==2.1.15
  Using cached GitPython-2.1.15-py2.py3-none-any.whl (452 kB)
Collecting docopt==0.6.2
  Using cached docopt-0.6.2.tar.gz (25 kB)
  Preparing metadata (setup.py) ... done
Collecting docker-compose==1.23.2
  Using cached docker_compose-1.23.2-py2.py3-none-any.whl (131 kB)
Collecting pygithub==1.43.5
  Using cached PyGithub-1.43.5.tar.gz (2.9 MB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [1 lines of output]
      error in PyGithub setup command: use_2to3 is invalid.
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

解决方法

应该安装pocoui,而不是poco。执行pip3 install pocoui,如下:

~ % pip3  install pocoui
Collecting pocoui
  Downloading pocoui-1.0.87.tar.gz (2.8 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.8/2.8 MB 1.5 MB/s eta 0:00:00
  Preparing metadata (setup.py) ... done
Requirement already satisfied: six in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from pocoui) (1.16.0)
Requirement already satisfied: requests in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from pocoui) (2.27.1)
Requirement already satisfied: airtest in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from pocoui) (1.2.5)
Collecting hrpc>=1.0.9
  Downloading hrpc-1.0.9.tar.gz (7.0 kB)
  Preparing metadata (setup.py) ... done
Collecting websocket-client==0.48.0
  Downloading websocket_client-0.48.0-py2.py3-none-any.whl (198 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 198.4/198.4 KB 7.2 MB/s eta 0:00:00
Requirement already satisfied: Jinja2>=2.8 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from airtest->pocoui) (3.1.2)
Requirement already satisfied: Pillow>=3.4.0 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from airtest->pocoui) (9.0.1)
Requirement already satisfied: mss==6.1.0 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from airtest->pocoui) (6.1.0)
Requirement already satisfied: numpy in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from airtest->pocoui) (1.22.3)
Requirement already satisfied: opencv-contrib-python in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from airtest->pocoui) (4.5.5.64)
Requirement already satisfied: facebook-wda>=1.3.3 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from airtest->pocoui) (1.4.6)
Requirement already satisfied: pywinauto==0.6.3 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from airtest->pocoui) (0.6.3)
Requirement already satisfied: python-xlib in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from pywinauto==0.6.3->airtest->pocoui) (0.31)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from requests->pocoui) (1.26.9)
Requirement already satisfied: idna<4,>=2.5 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from requests->pocoui) (3.3)
Requirement already satisfied: charset-normalizer~=2.0.0 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from requests->pocoui) (2.0.12)
Requirement already satisfied: certifi>=2017.4.17 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from requests->pocoui) (2021.10.8)
Requirement already satisfied: cached-property~=1.5.1 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from facebook-wda>=1.3.3->airtest->pocoui) (1.5.2)
Requirement already satisfied: Deprecated~=1.2.6 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from facebook-wda>=1.3.3->airtest->pocoui) (1.2.13)
Requirement already satisfied: retry in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from facebook-wda>=1.3.3->airtest->pocoui) (0.9.2)
Requirement already satisfied: MarkupSafe>=2.0 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from Jinja2>=2.8->airtest->pocoui) (2.1.1)
Requirement already satisfied: wrapt<2,>=1.10 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from Deprecated~=1.2.6->facebook-wda>=1.3.3->airtest->pocoui) (1.14.0)
Requirement already satisfied: decorator>=3.4.2 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from retry->facebook-wda>=1.3.3->airtest->pocoui) (5.1.1)
Requirement already satisfied: py<2.0.0,>=1.4.26 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from retry->facebook-wda>=1.3.3->airtest->pocoui) (1.11.0)
Using legacy 'setup.py install' for pocoui, since package 'wheel' is not installed.
Using legacy 'setup.py install' for hrpc, since package 'wheel' is not installed.
Installing collected packages: websocket-client, hrpc, pocoui
  Running setup.py install for hrpc ... done
  Running setup.py install for pocoui ... done
Successfully installed hrpc-1.0.9 pocoui-1.0.87 websocket-client-0.48.0

再在终端执行pip3 list能看到pocoui即可。
airtest报错ModuleNotFoundError: No module named ‘poco‘解决记录_第1张图片
参考链接:https://blog.csdn.net/weixin_49797392/article/details/118357639

你可能感兴趣的:(python,Airtest,pip3)