cmake来源:
只能find默认地址,我试过用虚拟的python地址提示缺python3config.cmake
源码来源:
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_exe
python_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")