Sample Header Ad - 728x90

How to `import FreeCAD` in CLI (python)

0 votes
1 answer
864 views
How can I import FreeCAD from the python console? I'm trying to write a script that can manipulate a given FreeCAD file, but I can't even get FreeCAD imported into the python console on a system where FreeCAD is installed.
user@disp7637:~$ sudo dpkg -l | grep -i freecad
ii  freecad                                       0.19.1+dfsg1-2+deb11u1             all          Extensible Open Source CAx program
ii  freecad-common                                0.19.1+dfsg1-2+deb11u1             all          Extensible Open Source CAx program - common files
ii  freecad-python3                               0.19.1+dfsg1-2+deb11u1             amd64        Extensible Open Source CAx program - Python 3 binaries
ii  libfreecad-python3-0.19                       0.19.1+dfsg1-2+deb11u1             amd64        Extensible Open Source CAx program - Python 3 library files
user@disp7637:~$ 

user@disp7637:~$ python3
Python 3.9.2 (default, Feb 28 2021, 17:03:44) 
[GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import FreeCAD
Traceback (most recent call last):
  File "", line 1, in 
ModuleNotFoundError: No module named 'FreeCAD'
>>> import freecad
Traceback (most recent call last):
  File "", line 1, in 
ModuleNotFoundError: No module named 'freecad'
>>>
I am running Debian 11
user@disp7637:~$ cat /etc/issue
Debian GNU/Linux 11 \n \l

user@disp7637:~$
How can I import FreeCAD in the python console?
Asked by Michael Altfield (382 rep)
Aug 16, 2023, 01:05 PM
Last activity: Aug 17, 2023, 03:05 PM