0

I am making a program that will call python. I would like to add python in my project so users don't have to download python in order to use it, also it will be better to use the python that my program has so users don't have to download any dependency.

My program it's going to be writing in C++ (but can be any language) and I guess I have to call the python that is in the same path of my project?

Let's say that the system where the user is running already has python and he/she calls 'pip' i want the program to call pip provided by the python give it by my program and install it in the program directory instead of the system's python?

It's that possible? If it is how can I do it?

Real examples: There are programs that offer a terminal where you can execute python to do things in the program like:

  • Maya by Autodesk
  • Nuke by The foundry
  • Houdini by Side Effects

Note: It has to be Cross-platform solution

Ricardo
  • 1,308
  • 1
  • 10
  • 21

3 Answers3

1

There are programs that "freeze" your python program including Python itself, for example Pyinstaller (http://www.pyinstaller.org/)

It won't help with the requirement in the third paragraph though, for that you'd have to include Python itself as part of the complete download, which seems unnecessary.

Bernhard
  • 1,253
  • 8
  • 18
1

In order to run python code, the runtime is sufficient. Under Windows, you can use py2exe to pack your program code together with the python runtime and all recessary dependencies. But pip cannot be used and it makes no sense, as you don't want to develop, but only use the python part.

To distribute the complete python installation, like Panda3D does, you'll have to include it in the chosen installer software.

Michael S.
  • 150
  • 1
  • 9
  • @Michel S. I don't want to use py2exe because have to be Cross-platform, also it's a plugin.... So, should I download the source code of python and put in in the same folder? – Ricardo Aug 08 '18 at 07:02
  • 1
    That's why I emphasized it's a Windows solution. Anyway, the interpreter itself (not the bytecode) is system specific, so you would need to ship an interpreter for each relevant system, anyway. At that point, it makes more sense to assume a local python installation as prerequisite, which can be more easily maintained. That way you also get around all the problems and security issues arising from outdated software. – Michael S. Aug 08 '18 at 08:58
0

You can use py2exe to turn you python program into an executable. You do not need to keep python in the executable.

hypadr1v3
  • 543
  • 4
  • 26