Importing Packages does not work with compiled python for windows


Following the instructions in PCBuild/readme.txt It was quite easy to me to get python.exe installed for windows(after installing git and nuget.exe manually)

Now i am able to run the new python.exe binary in the DOS box.

However i am not able to import packages inside the new python.exe
import ctype, import matplotlib, import numpy,
nothing works

In my python.exe which I installed from the offical package it works easily

Background is: i want to be able to import shared-library packages from within my embedded python windows build and to understand the mechanism behind.( fighting with crashes and not-found issues)

Its ctypes not ctype.

As for the others you have to pip install them before the import will work, use your built python to run pip like this:

python.exe -m pip install numpy

FYI no such thing as DOS anymore on Windows you mean CMD or POWERSHELL I assume.

Hi Barry, thank you for your valuable answer. it makes absolute sense.

I have tried to install numpy with my newly installed python.exe with your instructions given but I failed.
it said: “python.exe: No module named pip”
Admittedly it appears that the newly created python is quite standalone and bulk.
Which steps are necessary to “bootstrap” such naked pythons to work as good as the installed one ?
(can this be done by “patching” the python.exe or set lots of variables ?)

PS: of course I was using cmd.exe

I think you have to run ensurepip to setup pip.

Try python.exe -m ensurepip.