Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
I have written a python program (total size 2.8 mb) that uses SQLite database, need a Microcontroller that can run this program and how much RAM will simple Python program need ?
Python is interpreted language, so it requires a Python interpreter to run on anything. In order to run Python on a microcontroller you will need that microcontroller to run an OS, for which a Python interpreter is available - see Python implementations. You could also compile, and adapt if required, the Python source for a particular platform you wish to use. I guess it is possible to write a loader, that will start the core Python interpreter to run your script without the OS, but it will be really challenging. So probably the microcontroller will run an OS anyway and the requirements for hardware will be dictated by the OS. Also, you could benchmark your program and make assumptions for hardware requirements based on the results.
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
I have written a script (around 2k lines) for processing text.
It reads the input form my text file, and print the output in another file.
But, I want it can be run on any other laptop (with Python installed) easily as well. For example,
other people can run it without installing additional libraries (that I had imported in the script).
How can I realize my purpose? By packaging my script in a library or what else I can do? Please provide any hint.
I tried to use the pyinstaller or the py2exe, but I always have a problem of over recursion limit,
and since I have several huge sized libraries being imported, so I guess even I can finally make a .exe file,
it would be in a huge size, so I stopped to using that way. Anyone has a comment on it?
If you're sure that every client has Python and pip installed and present in PATH, you can just pip install the libraries in the beginning of your script. Something like this:
import subprocess
subprocess.run(['pip', 'install', '--user', 'your', 'libs'])
import your
import libs
This is just a general idea, maybe hacky, and definitely requires additional work with error handling, etc.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I have a Perl script that can convert a binary file into a text file. Rather than rewriting the script in Python, I was wonder I could use this Perl script in my Python program, package it, and distribute it to computers that don't have Perl preinstalled into it.
Perl has ways to embed a perl interpreter into another program: mod_perl for Apache is such a thing. If you wanted to make a Python module that had an embedded perl in it, you could probably make that happen.
It's probably less work to rewrite the functionality in Python though.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I was wondering what language are windows programs coded in? Can a python program run on windows if the computer doesn't have python installed?
I would recommend reading into this:
https://en.wikipedia.org/wiki/Portable_Executable
An EXE is a bundle of machine code. Take a look in a hex editor and grab an opcode manual. You probably won't be able to make sense of it without a lot of studying, but they're basically micro instructions.
To your other question, though. Yes, you can make an exe from a Python script. This works by bundling the python runtime with the script itself. Take a look at pyinstaller:
http://www.pyinstaller.org/
EDIT: As pointed out in the comments, use pyinstaller instead of py2exe. It is more actively maintained.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
Why don't people just use the compiled python file whenever they need optimization? Then the code won't have to be interpereted then compiled.
Is there something I am missing? It seems to me like a simple problem.
I believe this is enough to correct your misunderstanding.
A program doesn’t run any faster when it is read from a .pyc or .pyo file than when it is read from a .py file; the only thing that’s faster about .pyc or .pyo files is the speed with which they are loaded.
source : https://docs.python.org/2/tutorial/modules.html#packages
Python is interpreted even if it's read from a pyc-file. As already said in this answer, pyc-files only speed up program starting, not execution. Commands stored into pyc-files are not machine codes, it's just python level commands that will be interpreted anyway by python interpreter. On the other hand, when you use program written in C, executable file of such program consists of machine codes, that are "interpreted" directly by CPU.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I'm new to Python and downloaded the 2.x version on my Mac (I'm not using 3.x because my University course only allows us to submit work using 2.x).
However, having downloaded I'm not sure where to type my code, it was much more simple with Mathematica and Maple which I learnt last term. Here is a screenshot of all of the results when I type Python into my applications:
Then I click on the Python 2.7 option and this comes up:
I click on IDLE and it comes up with a platform for typing code, which looks like this
but I'm not sure if it's the correct one that I would be expected to submit work using. The reason for this is that it's called IDLE, whereas when I used Mathematica and Maple all I had to do was click on 'Mathematica' or 'Maple' and a platform would come up for typing code straight away.
Is IDLE the correct platform for typing code using Python?
It's not the correct one, it's just one of many possible ways to edit your .py files and work on Python projects. There are many other IDEs around, and some developers just use their favorite text editors with Python plugins
Unlike Mathematica, Maple and MATLAB, you're not really bound to any particular development environment