python / cpython

The Python programming language
https://www.python.org
Other
62k stars 29.81k forks source link

How to build and install Python from source on Windows on the command line? #121641

Open SamCoutteauHybrid opened 1 month ago

SamCoutteauHybrid commented 1 month ago

Documentation

On windows, following the documetation you can build a python using:

.\PCbuild\build.bat -e -p x64

This produces a directory arm64 containing a python executable and some other miscellaneous files, but it is missing folders such as Lib, includes, DLLs

This is unlike the unix steps

mkdir __build/
cd __build/
../configure ... -prefix=...
make
make install

This does seem to produce a full proper python installation.

I did see some documentation on how to make an windows installer. Are you supposed to build python from source, then create an installer and run it?, This seems strange in the context of a command line install. Or am I missing some other commands?

I would like to automate the process of building and installing python from source (on windows) but the documentation seems lacking on this part.

zooba commented 1 month ago

No doubt the documentation is lacking, but the answer is to run .\python.bat PC\layout --preset-default --copy <location> (noting that there are other presets besides "default", and a whole lot of individual options you might consider, so try passing -h to the PC\layout script too, or browsing that directory).

SamCoutteauHybrid commented 1 month ago

Thanks, I've just been able to test this and it does seem like what I was looking for. Shame the documentation is a bit lacking in this front.