1

I read somewhere you could run python without an OS. How would I do this? Would I need to compile it? Can I run it raw? And if I did need to compile it, what tool would I use and what format would I compile it to?

3
  • 6
    have a look at micropython Commented Sep 29, 2019 at 16:27
  • Python has to run within an OS. Maybe you mean Python that is OS-independent? ISTR there was a python you caould install onto a USB stick and plug and play Commented Sep 29, 2019 at 16:27
  • Yeah, how would os-independent python work? Could you please give me a link to an example? Does it have to go on a usb stick? And how would micropython work? Commented Oct 3, 2019 at 10:28

2 Answers 2

4

As far as I know there's not really any way to do this easily but I could be wrong. There are "portable" versions of python but these are operating system dependent. I think what you're referencing is some guys at PyCon managed to run python from the GRUB Bootloader. Your best bet would be installing some minimalist Linux distribution, with essentially only Python and some core packages required to run. The problem is that there's a lot of types of hardware out there, all with their own drivers and assembly language. Python can work as a low level language when you need it to but it seems like configuration would be a nightmare. I haven't looked into it super thoroughly but it seems difficult and impractical. Having an OS above python gives you access to the package managers IDEs and compilier options that make python worth using.

Sign up to request clarification or add additional context in comments.

2 Comments

Do you know how they got it to run from GRUB?
micropython is running on the Raspberry Pi Pico now. "MicroPython is a lean and efficient implementation of the Python 3 programming language that includes a small subset of the Python standard library and is optimised to run on microcontrollers and in constrained environments."
0

yea that's one of the options, pretty much all the "light" distros will be similar, if you want more to try out try here. Not sure why you're worried about speed though, if you're having speed issues it's far more likely to be the IDE you're using or your code bogging down the computer, not any sort of compiler issues.

2 Comments

Why did you post another answer instead of comment (which is basically a reply to his comment)?
What do you mean. I am not having speed problems!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.