[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...) .
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 AllSummary Data analysis is performed using python. The analysis itself is performed using pandas, and the final results are stored in...
Phenomenon I get a title error when trying to import firestore with raspberry pi. from from firebase_admin import firestore ImportError:...
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