Skip to content

Instantly share code, notes, and snippets.

@freckletonj
Created October 12, 2025 06:48
Show Gist options
  • Save freckletonj/c399728d39b4f31f53ddc55fb9bed8ec to your computer and use it in GitHub Desktop.
Save freckletonj/c399728d39b4f31f53ddc55fb9bed8ec to your computer and use it in GitHub Desktop.
FreeCAD venv environment
# If you want to develop for FreeCAD in an environment that is aware of all the baked-in imports, simply do this!
FreeCAD...AppImage --appimage-extract # create squashfs-root/ dir
# create venv using appimage's python
squashfs-root/usr/bin/python -m venv .env
# Add this to `.env/bin/activate`
export FREECAD_ROOT=<SQUASHFS_LOCATION>/usr
export PYTHONPATH=$FREECAD_ROOT/lib:$FREECAD_ROOT/lib/python3.11/site-packages:$FREECAD_ROOT/lib/python3.11:$FREECAD_ROOT/Mod:$PYTHONPATH
export LD_LIBRARY_PATH=$FREECAD_ROOT/lib:$FREECAD_ROOT/lib64:$LD_LIBRARY_PATH
# start your env
source .env/bin/activate
# run your editor
# run a python interpreter
# imports work! (import FreeCAD, import Part, import CAM, etc)
@freckletonj
Copy link
Author

With this, you can import FreeCAD, load FCStd files, run the interpreter, install whatever libs you want, etc and use it all from within your own editor/terminal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment