1

How to a python file run on any computer as I have to install python every time to get it to run on some new computer.

For example I file called foo.py

print("this should run on any computer")

How do I run this on anyone's computer?

martineau
  • 119,623
  • 25
  • 170
  • 301
John
  • 19
  • 3
  • You can't have it run on ANY computer. You can use tools like `pyinstaller` to turn your Python script into an executable, but that only works on machines with the same operating system. – Tim Roberts Mar 29 '22 at 20:57

1 Answers1

0

The solution is to use a program called pyinstaller to convert the py file to a exe file which can run on any computer.

John
  • 19
  • 3
  • This creates OS-specific packages, so it doesn't quite let you run it on *any* computer. – chepner Mar 29 '22 at 20:58
  • 1
    Also, simply pointing out the existence of `pyinstaller` does not really make for a good answer to a question. – chepner Mar 29 '22 at 20:59