cmake來源:
?只能find默認地址,我試過用虛擬的python地址提示缺python3config.cmake
python解釋器位置:
python控制臺位置:
pip install 裝包:
module_to_install = "your pakage"
import os
import FreeCAD
import addonmanager_utilities as utils
vendor_path = utils.get_pip_target_directory()
args = ["install", "--disable-pip-version-check", "--target", vendor_path, module_to_install]
appimage = os.getenv("APPIMAGE")
if appimage:python_exe = App.getHomePath() + "bin/python"
else:if hasattr(utils, "get_python_exe"):python_exe = utils.get_python_exe()else:from freecad.utils import get_python_exepython_exe = get_python_exe()
cmd = [python_exe, "-m", "pip"]
cmd.extend(args)
result = None
try:result = utils.run_interruptable_subprocess(cmd)FreeCAD.Console.PrintMessage("Install/Upgrade of " + module_to_install + " finished\n")
except:text = "Error trying to Install/Upgrade " + module_to_install + ". Please ensure pip is installed on your system and the module exists for this version of Python"FreeCAD.Console.PrintError(text + "\n")