Best setup for 'one' python environment that includes pcbnew scripting?


I am not a python guru but have a done a few scripts for various things around KiCad and I am not sure what the best way is to set it all up.

It seems that to use the python scripting with pcbnew, it needs to use the python.exe that is included with the python install.

However, I also have another python.exe on my system that I am using.

Depending on how I set it up with my PATH, I get the system python.exe with the various installed packages that I need, but it can’t find the pcbnew package. If I change the path to not include the system python.exe it finds the kicad python with the pcbnew but it can’t find my other installed packages.

I tried to install the required packages on top of the kicad python but that also has trouble.

So what is the best way to have ‘one’ python environment for all my scripts including the pcbnew scripting?



I have the same problem. I want to execute scripts that needs to import pcbnew but this only works within Kicad. I couldn’t copy the pcbnew libraries to my stantard python installation because returns plenty of error.

Could you solve the problem?


Have you tried to load the kicad python libs like suggested here into your systems python?


Hi, unfortunatelly is not just a file, is kind of library, there is as well DLLs… etc :frowning:


I have the same question. I’m running Linux Mint 19, and have no KiCad installed at all. I use KiCad 4 and 5 each as an AppImage. Anytime I want to run a python project that needs that pcbnew module, I get the error, that this module cannot be found.

ImportError: No module named pcbnew

EDIT: just tried to run kicad-boardview