'Is it possible to run python scripts without python installed in Linux?

I once did something similar under windows, copying the whole python and specifying PYTHONPATH by a .bat script to make it work locally.

But today I got a Linux server that has a strict working environment and won't allow me to install anything. And unfortunately I know little about Linux. I wonder is there a similar way that I can run python on the server?



Solution 1:[1]

Yes, you can use python docker images for running python scripts.

Solution 2:[2]

I've built stand alone executables using pyinstaller. It works well. I've only used it to deliver into Linux so far.

Solution 3:[3]

Sorry, I cannot put a comment because of my low reputation.

In short, you cannot run a Python script directly without the interpreter installed. Fortunately, you can install a Python environment without root permission by using Miniconda (or Anaconda), then make a virtual environment and install the required packages to run your code locally for your use only.

Solution 4:[4]

This answer is to leave some reference for the subsequent people who encounter the similar situation.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 rok
Solution 2 Paul Whipp
Solution 3 cao-nv
Solution 4 silver