I'm trying to generate a Python executable file with Pyinstaller on Linux. For this purpose I'm trying this implementation with a simple 'Hello World' file.
The issue I'm having is that when the executable file is generated and I execute it (double-click), nothing happens. There is no console popping out and I can see no execution. I have read in the documentation that in MacOS and Windows there are explicit options in order to make this console appear or not, but not in Linux.
Any idea?
You should open your console, and use "python file.py" or "python3 file.py" command (it depends on Python version), where file.py is your file.
I hope that I helped.
Related
I installed VSCode through Homebrew and I'm writing a basic program. Anything I try to print prints to the terminal instead of output. I have no coderunner settings that I can find based on other questions similar to this
Tried to reinstall without homebrew, same issue. Anything I print prints to terminal and not output
How did you run the python file?
You can use Run Python File button directly, you'll get the output in terminal.
If you use Run Code button, this is a function provided by code-runner extension. You have to add the following code to settings.json(Use shortcuts "Ctrl+Shift+P" and search for Preference: Open User Settings) so that file will be run in terminal:
"code-runner.runInTerminal": true,
I want to run python on vscode terminal but when i try to do so i get the following:
I use the code runner extension and i am enabling 'run code in terminal'option.
It used to work for me, but i have tried recently to run python on windows terminal by copying the entire thing vscode generates in it's terminal when building the executable(the path and everything) and pasting it to windows terminal, didn't work.
This is what i pasted: C:\Users\Yan\AppData\Local\tmc\vscode\mooc-programming-22\part05-27_letter_square> python -u "c:\Users\Yan\AppData\Local\tmc\vscode\mooc-programming-22\part05-27_letter_square\src\letter_square.py"
Please tell how to fix this and if what i did is the cause, then tell me also how to run python on windows terminal without causing this problem.
The command pasted to the windows terminal has somehow created a file named "python" (with no extension) in the "System32" folder.
Delete the file and the problem is solved.
I am using atom editor. I installed atom runner for run to my programs but i have encountered too many problems. I want to run pyfiles in cmd console automaticly. How can i do this
In a nutshell:
How can i run py files in cmd console with shortcut
I am using windows
This is honestly not related to stack overflow since this isn't exactly a computer programming question. More of an operating system question. However, I believe you can install bash (linux command line) on windows and this would help solve your problem. Here is a link:
https://www.windowscentral.com/how-install-bash-shell-command-line-windows-10
OR if you prefer using the windows command line, this link can explain how to run python (although i'd recommend using bash and not cmd):
http://www.cs.bu.edu/courses/cs108/guides/runpython.html
I suggest you install the "Script" extension and then run Atom using cmnd-I in the editor. Your file runs in the terminal.
I was helping a fellow Stack Overflow-er today and I noticed that I don't know what terminal IDLE uses in Windows. I am tacitly assuming that Python didn't write their own terminal for Windows, and that they probably use an API that gives them some version of cmd or powershell. I verified that the interpreter runs on cmd, but I don't know about IDLE.
What terminal does IDLE use in Windows?
IDLE is not built on an external shell or terminal, but on the Tkinter GUI toolkit.
The source code to the editor window can be read here; for the interactive shell, see here.
I have coded a program in Python 3.5 that uses the Tkinter import. I'm trying to figure out a way to run it on computers that don't have Python. First I tried freezing it but I haven't been able to because none of the freezing tools I found support Python 3.5. Then I tried possibly using a online idle but I couldn't find any that support Tkinter. I would prefer to be able to get a .exe file or something similar but if I could run it online that would be good too any ideas?
EDIT
So I have now successfully downloaded PyInstaller using pip. My current problem is when I type this into the console: pyinstaller.exe --onefile --windowed Finder.py
I get this error: 'pyinstaller.exe' is not recognized as an internal or external command,
operable program or batch file.
EDIT
I have now found the pathway to pyinstaller.exe. Now when I try to use it it says Access is denied.
I finally figured it out after about three days of work. Fist I downloaded PyInstaleller in the zipped form and extracted it. Then I put my program in the PyInstaller folder. Then I opened a regular command prompt. I then typed cd then the location of the PyInstaller folder. Finally I typed pyinstaller.py --one file --windowed program.py. Then when I went into the PyInstaller folder there was a folder called program with the .exe file in the dist folder. Thanks everyone for all of your help!
You can use pyinstaller to do that. I think its work fine on linux em linux.
Another option is use py2exe.
Try pyinstaller -F -w Finder.py as the command or you could check out CxFreeze.