安装uiautomator2报错:ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
ERROR: Command errored out with exit status 1:
command: 'c:\users\lyn\appdata\local\programs\python\python39\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\lyn\\AppData\\Local\\Temp\\pip-install-n05ckf2s\\uiautomator2\\setup.py'"'"'; __file__='"'"'C:\\Users\\lyn\\AppData\\Local\\Temp\\pip-install-n05ckf2s\\uiautomator2\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\lyn\AppData\Local\Temp\pip-pip-egg-info-uqbu4blh'
cwd: C:\Users\lyn\AppData\Local\Temp\pip-install-n05ckf2s\uiautomator2\
Complete output (34 lines):
WARNING: The wheel package is not available.
WARNING: The repository located at pypi.douban.com is not a trusted or secure host and is being ignored. If this repository is available via HTTPS we recommend you use HTTPS instead, otherwise you may silence this warning and allow it anyway with '--trusted-host pypi.douban.com'.
ERROR: Could not find a version that satisfies the requirement pbr (from versions: none)
ERROR: No matching distribution found for pbr
Traceback (most recent call last):
File "c:\users\lyn\appdata\local\programs\python\python39\lib\site-packages\setuptools\installer.py", line 128, in fetch_build_egg
subprocess.check_call(cmd)
File "c:\users\lyn\appdata\local\programs\python\python39\lib\subprocess.py", line 373, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['c:\\users\\lyn\\appdata\\local\\programs\\python\\python39\\python.exe', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', 'C:\\Users\\lyn\\AppData\\Local\\Temp\\tmpr104kg9r', '--quiet', 'pbr']' returned non-zero exit status 1.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "" , line 1, in <module>
File "C:\Users\lyn\AppData\Local\Temp\pip-install-n05ckf2s\uiautomator2\setup.py", line 8, in <module>
setuptools.setup(setup_requires=['pbr'], python_requires='>=3.6', pbr=True)
File "c:\users\lyn\appdata\local\programs\python\python39\lib\site-packages\setuptools\__init__.py", line 164, in setup
_install_setup_requires(attrs)
File "c:\users\lyn\appdata\local\programs\python\python39\lib\site-packages\setuptools\__init__.py", line 159, in _install_setup_requires
dist.fetch_build_eggs(dist.setup_requires)
File "c:\users\lyn\appdata\local\programs\python\python39\lib\site-packages\setuptools\dist.py", line 699, in fetch_build_eggs
resolved_dists = pkg_resources.working_set.resolve(
File "c:\users\lyn\appdata\local\programs\python\python39\lib\site-packages\pkg_resources\__init__.py", line 779, in resolve
dist = best[req.key] = env.best_match(
File "c:\users\lyn\appdata\local\programs\python\python39\lib\site-packages\pkg_resources\__init__.py", line 1064, in best_match
return self.obtain(req, installer)
File "c:\users\lyn\appdata\local\programs\python\python39\lib\site-packages\pkg_resources\__init__.py", line 1076, in obtain
return installer(requirement)
File "c:\users\lyn\appdata\local\programs\python\python39\lib\site-packages\setuptools\dist.py", line 758, in fetch_build_egg
return fetch_build_egg(self, req)
File "c:\users\lyn\appdata\local\programs\python\python39\lib\site-packages\setuptools\installer.py", line 130, in fetch_build_egg
raise DistutilsError(str(e)) from e
distutils.errors.DistutilsError: Command '['c:\\users\\lyn\\appdata\\local\\programs\\python\\python39\\python.exe', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', 'C:\\Users\\lyn\\AppData\\Local\\Temp\\tmpr104kg9r', '--quiet', 'pbr']' returned non-zero exit status 1.
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
python版本:3.8.8(>=3.8)
执行命令:pip install --pre uiautomator2
解决办法:卸载python3.8,安装python3.7,下面看官方说明