python – How can I distribute the .py program without the user having to install all the libraries?

Question:

I'm learning Python and I need to distribute a program, I read about cx_Freeze and py2exe to generate an .exe. However, I don't mind distributing the program code together, so I don't see the need to generate an .exe.

How can I distribute the .py program without the user having to install all the libraries used in the program? Can I create an installer?

Answer:

Well, I don't know if that's possible, but maybe you can do this to make it easier to install the packages:

Using a .bat file you can install the libraries using pip, for example:

start /w pip install numpy 
start /w pip install matplotlib
start /w pip install qualquerOutraBiblioteca
...

If you need to put the pip in the system path, before the code above, put:

SETX PATH "%PATH%;C:\Python33\Scripts"

If you need to install the pip, put first:

start /w python get-pip.py

Link to get-pip.py

About the pip.


If you want to generate an .msi installer, take a look at pynsist .

Scroll to Top