top of page

[python] How to run a python program on a PC that python has not been installed


Overview


In many cases, you want someone else to use a program written in python. But what if the other PC doesn't have python? Here's a method you can use in such cases.


1 Convert to exe file


You can use a library such as pyInstaller to convert .py files to exe files. Once converted to an exe file, it can be executed even if python is not installed.


2 IronPython


If you use a library called IronPython, you can use python in the .net development environment. You can also build to an exe file.



3 Copy the virtual environment together with the folder


Basically, you can use either 1 or 2, but if for some reason it is not possible (such as restrictions on the use of oss), There is a last resort: "Copy the entire folder of the anaconda virtual environment and pass along with the .py file". Whether it is a C # program or a bat file, I think that it will be executed by specifying the path of python.exe, so specify the path of python.exe in this virtual environment here.

However, if you copy the root environment as it is, the capacity of the folder will be 10GB or more, so you need to create a separate virtual environment that contains only the minimum required libraries (although it will still be 1GB...) .


There is a virtual environment in Anaconda3> envs, and python.exe in it

By the way, with this method, on a PC with python, on the contrary, it conflicts with the existing python and an error occurs when importing the module, so it is necessary to adjust sys.path to limit the search destination of the module.



Summary


First, consider making it an exe, and if it is absolutely impossible, copy the virtual environment together with the folder as a last resort.

Recent Posts

See All

[Python] Conditionally fitting

Overview If you want to do fitting, you can do it with scipy.optimize.leastsq etc. in python. However, when doing fitting, there are many...

Comments


Let's do our best with our partner:​ ChatReminder

iphone6.5p2.png

It is an application that achieves goals in a chat format with partners.

google-play-badge.png
Download_on_the_App_Store_Badge_JP_RGB_blk_100317.png

Let's do our best with our partner:​ ChatReminder

納品:iPhone6.5①.png

It is an application that achieves goals in a chat format with partners.

google-play-badge.png
Download_on_the_App_Store_Badge_JP_RGB_blk_100317.png

Theme diary: Decide the theme and record for each genre

It is a diary application that allows you to post and record with themes and sub-themes for each genre.

google-play-badge.png
Download_on_the_App_Store_Badge_JP_RGB_blk_100317.png
bottom of page