From 115a163408700960c258e26ac3107b951f2500e2 Mon Sep 17 00:00:00 2001 From: Isaac Date: Sun, 25 Aug 2024 22:24:07 -0400 Subject: ok2 --- required_modules.py | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/required_modules.py b/required_modules.py index 06661c5..fe5ded3 100644 --- a/required_modules.py +++ b/required_modules.py @@ -1,26 +1,27 @@ -import bpy, sys +import bpy from subprocess import run # get python's binary path (literally my saviour) py_bin = bpy.app.binary_path_python -upd_mods = ["wheel", "setuptools"] -trusted_hosts = ["--trusted-host", "pypi.python.org", "--trusted-host", "files.pythonhosted.org", "--trusted-host", "pypi.org"] +pip_install = [py_bin, "-B", "-m", "pip", "install", + "--trusted-host", "pypi.python.org", + "--trusted-host", "files.pythonhosted.org", + "--trusted-host", "pypi.org", + "-U", "--force-reinstall", "--only-binary", ":all:"] +upd_mods = ["pip", "wheel", "setuptools"] +new_mods = ["lxml"] try: import pip import lxml except: # hecking install pip (ensurepip) + required modules - run([py_bin, "-m", "ensurepip"]) - # update pip, setuptools and pyinstaller to latest version - run([py_bin, "-m", "pip", "install", "--upgrade", "--force-reinstall", "pip"] + trusted_hosts) - run([py_bin, "-m", "pip", "install", "--upgrade"] + upd_mods + trusted_hosts) - # install required modules depending on python version - if (sys.version_info.minor == 5): # blender 2.79b - run([py_bin, "-m", "pip", "install", "lxml==4.9.3"] + trusted_hosts) - else: # blender 2.79 latest - run([py_bin, "-m", "pip", "install", "lxml"] + trusted_hosts) + run([py_bin, "-B", "-m", "ensurepip"]) + # update basic modules then download new modules + run(pip_install + upd_mods) + run(pip_install + new_mods) print("First exit!") + bpy.ops.wm.quit_blender() exit(0) # print module's versions installed -- cgit v1.2.3-70-g09d2