Change the interpreter in Pycharm but it doesn't work - python

I changed the interpreter from python3.7 to python2.7 in Pycharm. But after I did this process, the interpreter showed success but actually, when I ran the code it still was running with python 3.7.
The interpreters are set from the anaconda.
This image shows that I have changed the external library to Python 2.7 but when I test the type of python in the terminal, it still shows in Python3.7.
I really struggle about this problem, hope someone can help me.

I believe you face a known PyCharm bug: PY-23417. IDE fails to activate the conda environment in the terminal so you end up running Python 2 instead of 3 by python executable as it uses the first interpreter in PATH.
Try PyCharm 2019.1 EAP build. The problem should be resolved there.

Related

Pycharm runtime: No Python at dir\that\doesnt\exist

I had Anaconda installed as well as Python3 and this was causing some conflicts. I removed Anaconda and ensured my PATH variables all point to the Python3 install at C:\Users\me\AppData\Local\Programs\Python\Python38-32
I have opened a project in PyCharm and set the python interpreter to that very path: no venv in case it was causing problems.
However, when CTRL+SHIFT+F10 to run it states No Python at 'C:\Users\me\Anaconda3\python.exe'
I have googled this for the past two hours and all I'm finding is "you haven't installed Python" or "set up the PyCharm interpreter to point to the python executable" which I have done.
I have even reinstalled Pycharm.
Please can someone suggest what I am doing wrong? There is no sign of Anaconda in the system or in the PyCharm terminal interpreter/project interpreter Thanks.
Edit:
Forgot to mention, in the Project > Python Interpreter settings I can see the interpreter and all the packages just fine. On the face of it: Everything is working fine. But run-time is giving me the anaconda install dir error.
Try restarting pycharm once...if not your System..Comment here if it doesn't solve the issue.
I don't know what caused this problem but it resolved itself. Sorry I cannot offer any insights.

Why my Python 2.7 envs only works when I start the terminal by Anaconda Navigator?

All python 2* envs I created doesn't really start when activating dicrectly from cmd. When activating this way, there is no error message on the prompt, all seem to be ok, then I run python 2 scripts and they doesn't work. Only way I found to do it is by starting the terminal from Anaconda Navigador. This also happens with Pycharm: code doesn't works when running py2 scripts in Pycharm WITHOUT having started it from Anaconda Navigator.
Computer programming and configuration is not my professional area, so if the answer relates to configuring path, or system variables, please be kind giving me a "for dummie" explanation.
I'm using Windows 10.
Thanks!

VScode didn't recognize python3

I just installed my ubuntu on my PC then i installed python 3 & Vscode on my PC. but my VS Code didn't recognize the python3. maybe my vs code looking for my python. how to solve this?
In my VS Code when I compiled the class then the output:
python -u "/home/kisiniki/Documents/python/tempCodeRunnerFile.py"
/bin/sh: 1: python: not found
In my terminal already installed python 3.6.8.
First, try to see if you are able to run the same command in terminal.
python -u "/home/kisiniki/Documents/python/tempCodeRunnerFile.py"
If you are getting the same error, "python: not found", then likely python installation was not completely successful, you can either uninstall and reinstall or you can try to update PATH to contain the folder containing the python executable. See https://askubuntu.com/questions/637848/how-to-reset-python-path-to-usr-bin-python for more detail.
If you can run the command in terminal, then that means VS Code cannot find your installed python. See if you need to edit some settings in VS Code for it to know what python executable to run. See
https://code.visualstudio.com/docs/python/environments for more detail.
It's probably because you used the command python without having an activated virtual environment or not using python3 or python3.6. Try it with python3.6 and see if that fixes it. If it doesn't then Python isn't on your PATH.

Pycharm stopped showing output after i changed the project interpreter to Anaconda3

I used to work with Pycharm and it was working pretty well till the time I changed the Interpreter to Anaconda3. From then onwards whatever I ran gave me no output on the console window.
The console window is just showing this:
Process finished with exit code 0
There is something wrong but I am unable to find it.
Check if Anaconda is setup properly, validated by opening the terminal within pycharm and checking say for the version of a package that you have installed as part of Anaconda, like I have installed Django as part of virtualenv. I tested that the environment is active in the terminal and tested the version of Django. eg: python -m django --version This gave me the version that I expected - 11.3.
Also this is a site from Anaconda that shows how to get the Anaconda configured for Pycharm, just incase you need it.
https://docs.continuum.io/anaconda/user-guide/tasks/integration/pycharm

Python 3.5.2 can be accessed through Terminal, but IDLE for 3.5.2 is missing

I am just getting started with Python and computer programming in general, so hopefully someone can help me out. I am trying to use PyQt4 to start learning how to code GUI's, and eventually use py2app to bundle these GUI's into Mac Applications...
The issue I am having is I just installed PyQt4 (or so I thought) on my computer, using MacPorts (http://www.pythonschool.net/pyqt/distributing-your-application-on-mac-os-x/). When following the guide, I did slightly modify the code I entered into terminal. At first, when I typed the sudo port install py33-pyqt4 command into Terminal, it returned
Error: Port py33-pyqt4 not found
So, I changed the command to sudo port install py35-pyqt4, which successfully installed python 3.5.2 along with PyQt4. When I type python3.5 into Terminal, Python3.5.2 loads, with PyQt4 working as well. I am able to import modules from PyQt4. Not sure if changing the command to install python 3.5.2 is what cause my issue.
The issue is this: I am unsure how to use IDLE (or another IDE, PyCharm for example) with python 3.5.2! I cannot find an IDLE version for python 3.5.2 on my computer. I do have python 3.5.1 and python 2.7 installed, along with their respective IDLE programs. PyQt4 modules, however, cannot be imported when I use these IDLE versions.
When I issued the sudo port install py35-pyqt4 command, did it install IDLE somewhere? Am I able to use PyCharm with python 3.5.2, if python 3.5.2 loads properly into Terminal? I just need some way to edit scripts outside of Terminal. Hopefully this is a clear enough question!
UPDATE:
I found the IDLE program... Realized that it was installed through MacPorts it is located in a MacPorts folder in my Applications folder. The only issue it that it will not open. Frustrating.
I also have IDLE programs which won't start. Not sure why.
If you are willing to use PyCharm, I would recommend that to you anyway. You can change the pythonpath in the PyCharm Settings -> Build, Execution, Deployment -> Console -> Python Console -> Python interpreter. Select here the appropriate Python binary.
If you are unsure about the pythonpath, type
which python3.5
in a terminal which should give you the path.
With that, PyCharm uses this Python version as your default.

Categories