From 5297d6b2cca54fab12ed62b96df8207f10f8c02c Mon Sep 17 00:00:00 2001 From: Isaac Date: Sat, 24 Aug 2024 18:42:19 -0400 Subject: attempt to make blenxy install its required modules by itself --- required_modules.py | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 required_modules.py (limited to 'required_modules.py') diff --git a/required_modules.py b/required_modules.py new file mode 100644 index 0000000..98af424 --- /dev/null +++ b/required_modules.py @@ -0,0 +1,36 @@ +# I tried... + +# setup pip with ensurepip if it isn't included +try: + import pip +except: + import ensurepip + ensurepip.bootstrap() + print("First exit!") + exit(0) + +# upgrade pip (check the version installed by ensurepip) +if (int(pip.__version__.split('.')[0]) > 9): + from pip._internal import main +else: + from pip import main + +# 24.0 is the last version for python3.7 +import certifi +if (int(pip.__version__.split('.')[0]) < 24): + main(["install", "--cert", str(certifi.where()), "--upgrade", "--force-reinstall", "pip", "-q"]) + print("Second exit!") + exit(0) +import pip +print("pip %s is installed!" % (pip.__version__)) + +# check if lxml is installed +try: + import lxml +except: + main(["install", "lxml"]) + print("Third exit!") + exit(0) +print("lxml %s is installed!" % (lxml.__version__)) + +# no more exits please... -- cgit v1.2.3-70-g09d2