Skip to content

Error in installModule function #5

@Alexxkrehmen

Description

@Alexxkrehmen

This line is not working on Windows, with blender 4.5 :

subprocess.call([python_exe, "import ", packageName])

Here is a suggestion for fixing this

def installModule(packageName):
     python_exe = python_exec()
     try:
         subprocess.check_call([python_exe, "-c", f"import {packageName}"])
     except:
         # upgrade pip
         try:
             subprocess.check_call([python_exe, "-m", "ensurepip", "--default-pip"])
         except:
             pass  # ensurepip can fail if not already installed
         # install required packages
         subprocess.check_call([python_exe, "-m", "pip", "install", "--upgrade", "pip"])
         subprocess.check_call([python_exe, "-m", "pip", "install", packageName])

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions