Pycharm default interpreter - python

Every single time I open Pycharm I get the "no Pyhon interpreter configured for the project", so I go to Settings -> Interpreter and choose it from the list. But as soon as I close Pycharm and open it again next time, I receive the same message. I went crazy on trying to google for the answer, is there anyway to solve this? I've had Pycharm for a long time and never had this kind of an issue. Fresh install on win 8.1.

You should set the default interpreter for PyCharm, For that, go to :
File > Preferences for New Projects > Project Interpreter

Related

My python interpreter runs in interactive mode on its own

Python version : 3.6.1
Pycharm version : 2018.1 EAP (Professional Edition)
My python interpreter runs in interactive mode ON ITS OWN!!
I just ran the script
I ran the python script in PyCharm in the way that I usually did.
The interpreter had worked very well until the last night(2018/01/31) but...
But the interpreter has been changed like this
it has been changed in interactive mode AUTOMATICALLY.
I did just sleep, wake up and run it.
This is what actually I had seen
ran like this until the last night.
(I brought it from Google because I don't have a capture.)
PyCharm Preferences
But that doesn't mean that -i is in the interpreter option.
I got some solution that unchecking
"Show command line afterwards" box works, but I cannot find it.
import sys
print(sys.flags.interactive) # 0
Checked interactive flag is False.
It is kinda useful using interactive interpreter but I am now just uncomfortable for it.
How do I change it to uninteractive???
Go to Run > Edit configurations... menu. Select Python > your-script-name on the left and un-check the option Show command line afterwards on the right:
You'll find the option in Run > Edit Configurations

Installed older version of Python, can't get PATH to direct

I'm receiving the message:
The program can't start because python34.dll is missing from your computer. Try reinstalling the program to fix this problem.
I want to use python27, so I uninstalled python34, but can't get the cmd prompt to redirect to the python27 .dlls.
In the prompt I typed setx PATH "c:\python27" and it says successful. I close out of the prompt, open it again, type Python, and I get the same message.
Here is a screenshots of the error:
And a screenshot of the response to the setx command:
How can I fix this?
I would suggest you manually edit your PATH (through Windows' GUI instead of CMD) and ensure two things:
a) That C:\python27 is in there and
b) That C:\python34 is not in there
Also, after doing that, make sure you close all open cmd.exe dialogs before opening a new one and testing again.
CMD is a bit weird in my experience, it seems like as long as one instance of it is running, Windows won't propagate environment variable changes to any instances of it (even new ones created after the change). I wasted a lot of time in the past troubleshooting issues similar to yours until I figured that out, so I think it's worth mentioning here.

A very basic setting issue about spyder and anaconda for python

I am a beginner of spyder IDE for Python.
To use spyder IDE, I command "spyder" on anaconda console with python 2.7
After that, I try to print "hi"
But I encounter an error message
"No python shell is currently selected to run hu.py Please select or open a new Python interpreter and try again"
How could I solve this problem?
I saved my file on C:\Anaconda\practice_jhk
from __future__ import print_function
print ("hi")
You can specify the Spyder's Run Settings in Run -> Configure (F6). By default "Execute in current Python or IPython console" is selected and you probably do not have any open console in Spyder.
You can select "Execute in a new dedicated Python console" option and Spyder will automatically open a new console for you. Or you can leave the dafault option and create a new console yourself in the Consoles menu.
I have had the same problem. I am not able to fix it but I am able to successfully run the program the following two ways and I don't find any problems till now:
By selecting IPython console (not the one with the Kernel id as its tab) then running your program.
By selecting "Execute in new dedicated Python console" from Tools --> Preferences --> Run.
I was getting the same error message, but then realized I was not directing the PATH to my Python interpreter file at all. How I solved the problem:
Go to Tools > PYTHONPATH manager
Select "Add path"
Find and select your Python interpreter folder (for me this was C:\Python27)
Try, tools -> Reset sypder to factory default. Then, click on the run button in the dialog box.
I had this issue when I didn't have the python console pane open.
To resolve this, in the top bar go to: view -> panes and turn ipython console on.
This fixed it for me.
You might have unexpectedly closed the Ipython console window which is open by default and that caused the error.
Go to Consoles > New console(default settings)

Launching Python has encounterd a. Unable to get project for the run

Launching Python has encounterd a problem. Unable to get project for the run
It would let me put the word problem in the title.
The title is the exact message i get when i try to run/debug a file in Aptana 3.
I have always been able to run Python in Eclipse without problems. Does anyone know what causes this error?
For testing purposes i just created a new Pydev project with only 1 file in it.
I had the same problem with Aptana and just solved it. In my case I had configured another interpreter (IronPython) for running another script. When I got back to a previous script I got the same error message as you "Unable to get project for the run" because it was trying to run it with IronPython instead of Python.
I would therefore recommand the following:
1) Check your interpreter configuration.
-> Window -> Preferences -> Pydev -> Interpreter Python
If you have no interpreter there try autoconfig. If it doesn't work you will have to browse it yourself by clicking New (then it should be somewhere like C:\Python27\python.exe)
2) If you have an interpreter, it means that Aptana is trying to run your script with another interpreter. In that case right click on your script file in Aptana -> Run as -> Python run.
That worked for me.
Good luck !
Go to Run -> Run configurations -> Python run
delete "New configuration"
then it must work
It occurs when you create a New configuration for run a program.
go to Run > run configuration > python run
select "New configuration"
press on delete icon
and again Run the program .
this is worked for me .
I had similar issue. Below action solved my problem.
Go to Run > run configuration > python run
Delete all the configurations below python run - it may not be a great option if you have any custom configuration settings.

How to start IDLE (Python editor) without using the shortcut on Windows Vista?

I'm trying to teach Komodo to fire up IDLE when I hit the right keystrokes. I can use the exact path of the shortcut in start menu in the Windows Explorer location bar to launch IDLE so I was hoping Komodo would be able to use it as well. But, giving this path to Komodo causes it to say that 1 is returned. This appears to be a failure as IDLE doesn't start up.
I thought I'd avoid the shortcut and just use the exact path. I go to the start menu, find the shortcut for IDLE, right click to look at the properties. The target is grayed out, but says "Python 2.5.2". The "Start in" is set to, "C:\Python25\". The "Open File Location" button is also grayed out.
How do I find out where this shortcut is really pointing? I have tried starting python.exe and pythonw.exe both in C:\Python25, but neither starts up IDLE.
There's a file called idle.py in your Python installation directory in Lib\idlelib\idle.py.
If you run that file with Python, then IDLE should start.
c:\Python25\pythonw.exe c:\Python25\Lib\idlelib\idle.py
In Python 3.2.2, I found \Python32\Lib\idlelib\idle.bat which was useful because it would let me open python files supplied as args in IDLE.
Here's another path you can use. I'm not sure if this is part of the standard distribution or if the file is automatically created on first use of the IDLE.
C:\Python25\Lib\idlelib\idle.pyw
If you just have a Python shell running, type:
import idlelib.PyShell
idlelib.PyShell.main()
there is a .bat script to start it (python 2.7).
c:\Python27\Lib\idlelib\idle.bat
Python installation folder > Lib > idlelib > idle.pyw
Double click on it and you're good to go.
You can also assign hotkeys to Windows shortcuts directly (at least in Windows 95 you could, I haven't checked again since then, but I think the option should be still there ^_^).
The idle shortcut is an "Advertised Shortcut" which breaks certain features like the "find target" button. Google for more info.
You can view the link with a hex editor or download LNK Parser to see where it points to.
In my case it runs:
..\..\..\..\..\Python27\pythonw.exe "C:\Python27\Lib\idlelib\idle.pyw"
I setup a short cut (using windows) and set the target to
C:\Python36\pythonw.exe c:/python36/Lib/idlelib/idle.py
works great
Also found this works
with open('FILE.py') as f:
exec(f.read())
Another option for Windows that will automatically use the most recent version of Python installed, and also doesn't make you look for the installation path:
Target: pyw -m idlelib
Start in: Wherever you want
I got a shortcut for Idle (Python GUI).
Click on Window icon at the bottom left or use Window Key (only Python 2), you will see Idle (Python GUI) icon
Right click on the icon then more
Open File Location
A new window will appears, and you will see the shortcut of Idle (Python GUI)
Right click, hold down and pull out to desktop to create a shortcut of Python GUI on desktop.
Python installation folder > Lib > idlelib > idle.pyw
send a shortcut to desktop.
From the desktop shortcut you can add it to taskbar too for quickaccess.
Hope this helps.
If it's installed on windows 10 without changing default location, it seem it is in "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.1776.0x64__{BUNCHOFRANDOMSTRINGS}"
and you won't be able to open it.
Good luck finding how open .py by default with idle.

Categories