git clone --recurse-submodules https://github.com/FreeCAD/FreeCAD.git freecad-source
bash /home/chen/代码/freecad-source/package/ubuntu/install-apt-packages.sh
vscode 扩展安装cmake tool
把/home/chen/代码/freecad-source/contrib下的.vscode复制到根目录
启动vscode
按f5
module_to_install = "debugpy"
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")