Reputation: 2217
Update:
When i had set an interpreter and configured it to point to a script, the run button was grayed out (as shown in the screenshot).
But then i went Run-> Run (point to this config) (i thought id already tried this before, but maybe not since the restart).
Then it worked, and now it is no longer grayed out.
However, to run another script i still have to configure to point to the new script with the same config.
I was wanting to not have to do that and i still don't have a solution to do that.
I dont see why i should have to point it to the script that i have open, obviously the one i have opened is the script i wish to run. Maybe it is just coded this way...
But my particular question as it was is solved. I didnt word it correctly.
Update: After updating PyCharm to newest version i got this error:
which may or may not be relevant to this question.
Just started with python not long ago.
How do i get PyCharm to use the same virtual env interpreter or (default one) on any project/script?
I want it to work out of the box like Java does.
I keep having to have to set an interpreter for each script.
Upvotes: 1
Views: 3137
Reputation: 2217
When i had set an interpreter and configured it to point to a script, the run button was grayed out (as shown in the screenshot). But then i went Run-> Run {point to particular config} Then it works, and now is no longer grayed out. Then, to run another script i still have to configure to point to the new script with the same config (config is reusable).
I was wanting to not have to keep pointing to new scripts. I dont see why i should have to point it to the script that i have open, obviously the one i have opened is the script i wish to run. Maybe it is just coded this way in this IDE (which im not impressed with sofar)... But my particular question as it was is solved. I didnt word it correctly.
Update:
I since realised that the problem was probably that id opened files from different folders and was trying to run them. When i open a folder of source files, configuriing the interpreter for this folder allows me to right click on each source file and run, without pointing the interpreter to the script. I can then just use the drop down for the scripts that have been run before.
Upvotes: 1
Reputation: 21
Try shutting down PyCharm completely and when you start it back up, go to 'Configure' first before creating a new project. Then go into 'Preferences' from there.
PyCharm has a button in the "Python Interpreters" section to create new Virtual Environments. Use that to create a fresh one. I usually update any packages that show as outdated in the window below (seems PyCharm uses a different 'pip' than what you might have installed).
Then go ahead and create a new project assigning that virtualenv as the project interpreter.
Upvotes: 1