I just upgraded to windows 10, and downloaded the Anaconda Python distribution and chose the option for it to add everything to my PATH etc. Back in windows 8 when I created a .py file I could execute it from the file explorer just by clicking on it, but for some reason windows 10 won't recognise .py files and when I try run them it opens them in notepad. I am able to run them from the command line. What's gone wrong?
UPDATE: When I choose another application to open the file, I click on the python application and it says "Cannot Execute as Python27.dll is not found", I installed python 3, why is it trying to open in python2.7?
Choose open with, then scroll down and click something like "choose another application from this computer" (I don't exactly know, I use windows in different language). Then just select your Python executable and click OK.
Related
I want to add Spyder to the Windows File Explorer right-click menu, or at a minimum add Spyder to the right-click "Open with..." menu in File Explorer.
I routinely use Notepad++ to inspect Python files as text files. I have Notepad++ set as the default .py editor for Windows File Explorer, because I much more frequently inspect Python files than run them.
I Spyder installed on Windows 10 Professional using Anaconda. I routinely upgrade Spyder using conda (as recommended by the Spyder-ide support website on Github). I chose NOT to install and register Anaconda as my default Python installation. This is what is recommended by Continuum Analytics and others. This is probably why Anaconda did not install Spyder as a right-click option in Windows.
I tried to select Spyder from the "Open with...Choose another app" sequence in Windows, but it gives me an error message "
This is not a duplicate of other similar questions on SO. I do NOT want to automatically launch Spyder when double-clicking on .py files in Windows File Explorer, as can be found here: How to get Spyder to open python scripts (.py files) directly from Windows Explorer.
Does someone have a script to register Spyder (or other applications or batch files) on the Windows 10 File Explorer "Open with..." right-click menu? I have found only old and complicated solutions with pywin32 that no longer work in Windows 10.
I have an additional right-click launch option for PyCharm, but not for Spyder.
I am trying to open my python files with a double click. I normally open them in anaconda prompt which uses the powershell file found in C:\Windows\System32\WindowsPowerShell\v1.0. I tried using open with and navigating to this file, however then the promt window opens and immediately closes... the script should run continuously.
I also tried opening it with the "python (command line)" file which I found in C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Python 2.7 I cannot open the location of that file for some reason using right click> open file location, however I tried to open my script using this but again the same thing happens.
It is frustrating as I need to close and open my scripts often. Each time I have to load up anaconda prompt, type in python and drag the file, and than press enter.
Any help would be appreciated.
I have installed Python 3.7 btw that I installed with ana and am trying to avoid reinstalling python as I have so many npm installs done that I did not keep a log of.
Try to open file/folder in other IDE like vscode, pyCharm or text editor.
Open IDE first after that click on file menu and select open option.Browse the file/folder and select it.
I'm setting up my home computer for basic python development. I've managed to install Anaconda through the command line but I'm not sure how to make .py files run through the Anaconda interpreter when double-clicked.
i.e. I did this on my Windows computer at work by right clicking on a .py file and then choosing open with > open with another application > navigating to {C:\Users\\AppData\Local\Continuum\anaconda3} > clicking on python.exe and then clicking 'open'. Is there an equivalent way of doing this on Linux? I'm running Pop!_OS.
I've tried clicking 'open with' but there was no option to open with another application. I also wouldn't know what type of file I would be looking for whereas I knew in Windows I was looking for a .exe
I've also tried right clicking on a .py file, going on the 'Permissions' tab, checking the box for 'Allow executing file as a program' and going to Files > preferences > Behaviour and changed the Executable Text Files option from 'Display them' to 'Run them'.
The most common way on linux to make things executable is by adding the executable flag to the file. On command line, if your file is called script.py:
chmod +x script.py
It is important that your script starts with a description of how to execute it.
For python, your script should start with:
#!/usr/bin/env python
Also, for clarification, there is no .exe file in Linux. The equivalent to that is the previously mentioned executable flag.
So I had python for a long time, but I didn't code just downloaded scritps and all that. I wanted to install python 3.7, when I did everything seemed to work fine, but my .py files didn't open.enter image description here
Images
You may tell windows what program should open py files with. If you want to open them with a text editor or a python interpreter installed, etc. Go to start menu and type "default programs", from there you need to tell windows what praogram you want to associate with py file
Just installed Python 2.7.3 on a Windows7 machine.
How do I get .py files to be associated with python (they are with notepad ATM) and how do I get the context menu shortcut for "edit in IDLE"? Somehow I didn't get that on this particular computer.
try making a .py file and then try to open it, and a window should appear asking you what to open it with, and then select idle in your program files.