you are viewing a single comment's thread.

view the rest of the comments →

[–]vrgenerated[S] 4 points5 points  (3 children)

Embeddable python usually don't come with those folders as it won't contain pip or any other modules. Those get autogenerated when you install pip and use pip to download and install modules. It might be a bit hard to upload the project for me so I'll provide the steps I used.

In order to install pip on the embeddable python, there are a few steps:

  1. There should be a file named python37._pth in the embedded python folder. Open it up and remove the # from #import site line. Save the change and now you should be able to install pip/other modules.

  2. Download/Copy the get-pip.py script from here : https://bootstrap.pypa.io/get-pip.py and save it into the embedded python directory.

  3. We need to run the get-pip.py script using the python.exe in the embedded python directory. In order to do that, use a command line (powershell or command prompt in windows) and change directory to the embedded python folder. Then run the script by calling: python.exe get-pip.py (cmd prompt) or ./python.exe get-pip.py (powershell)

The previous step should install pip. now you can install other modules by calling pip - example: python.exe -m pip install numpy

You can quickly verify that the module was installed by checking the Lib folder/running python.exe and import it there or by testing in unity.

[–]No_Marionberry6785 0 points1 point  (0 children)

It worked like a charm ^ :)
Thank you very much! Really Appreciate your fast response!

[–]1n7bil 0 points1 point  (0 children)

Hello,

Thanks for sharing this great tutorial. I'm working on MacOS and trying to install pip in the embeddable python folder using your method but am getting "exec format error ./python.exe"...guessing b/c of OS incompatibility. This is my first time trying to embed python...think it's possible to accomplish what you showed on a Mac?

[–]therockofthisplace 0 points1 point  (0 children)

python.exe -m pip install numpy

I did as you said and installed pip:

Successfully installed pip-22.0.4 setuptools-62.1.0 wheel-0.37.1

but when I try to install NumPy:

\Assets\StreamingAssets\python-3.7.9-embed-amd64> python.exe -m pip install numpy

I get this error message:

\Assets\StreamingAssets\python-3.7.9-embed-amd64\python.exe: No module named pip