from importlib import import_modulefrom os import environimport sysfrom packaging.version import Versionfrom pythonforandroid.prerequisites import (check_and_install_default_prerequisites,)def check_python_dependencies():"""Check if the Python requirements are installed. This must appearsbefore other imports because otherwise they're imported elsewhere.Using the ok check instead of failing immediately so that allerrors are printed at once."""ok = Truemodules = [("colorama", "0.3.3"), "appdirs", ("sh", "1.10"), "jinja2"]for module in modules:if isinstance(module, tuple):module, version = moduleelse:version = Nonetry:import_module(module)except ImportError:if version is None:print("ERROR: The {} Python module could not be found, please ""install it.".format(module))ok = Falseelse:print("ERROR: The {} Python module could not be found, ""please install version {} or higher".format(module, version))ok = Falseelse:if version is None:continuetry:cur_ver = sys.modules[module].__version__except AttributeError: # this is sometimes not availablecontinueif Version(cur_ver) < Version(version):print("ERROR: {} version is {}, but python-for-android needs ""at least {}.".format(module, cur_ver, version))ok = Falseif not ok:print("python-for-android is exiting due to the errors logged above")exit(1)def check():if not environ.get("SKIP_PREREQUISITES_CHECK", "0") == "1":check_and_install_default_prerequisites()check_python_dependencies()
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。