check FC version on Linux using Python or Shell command

Having trouble installing or compiling FreeCAD? Get help here.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
Oli772
Posts: 26
Joined: Wed Apr 27, 2022 2:35 pm

check FC version on Linux using Python or Shell command

Post by Oli772 »

Hello,
how do I check the FC version I use under Linux using, preferably, a python command or, else, a shell command ?
User avatar
adrianinsaval
Veteran
Posts: 5541
Joined: Thu Apr 05, 2018 5:15 pm

Re: check FC version on Linux using Python or Shell command

Post by adrianinsaval »

in python:

Code: Select all

import FreeCAD
FreeCAD.Version()
but you would likely need to add the freecad lib directory to sys.path, you can also try import freecad instead as in some systems that is in the site-packages directory.
in shell, on of these:

Code: Select all

FreeCADCmd --version
FreeCADCmd -c 'print(FreeCAD.Version())'
the second does the same as the python commands above. Depending on your system you might have to use the lowercase form of that command, freecadcmd
What distro are you running and how did you install freecad?
Oli772
Posts: 26
Joined: Wed Apr 27, 2022 2:35 pm

Re: check FC version on Linux using Python or Shell command

Post by Oli772 »

the distro is Ubuntu 20.04 LTS.
I upgrade FC 0.18 to 0.19 using PPA.

I have found a bash command which looks doing the job:

Code: Select all

dpkg-query -W -f='${binary:Package} ${Version}\n' freecad
then I call it from python as a subprocess
User avatar
adrianinsaval
Veteran
Posts: 5541
Joined: Thu Apr 05, 2018 5:15 pm

Re: check FC version on Linux using Python or Shell command

Post by adrianinsaval »

are you interested in checking the version of FreeCAD in general or specifically of the deb package you have installed? btw the current stable release is 0.20.1 but it might not be in the ppa since nobody is maintaining that anymore, consider using a newer version through appimage/conda/flatpak/snap
Post Reply