I have recently installed debian10 and VSCode. I have checked the currently installed version of python on my system is and it is python 3.7.3. This is also the version returned by python --version. When running python --version in terminal of vscode it returns python 3.8.8. When i go to select the python interpreter it only gives me options to select python 3.8.8. If i specify the path python i am currently using(python 3.7.3) it does not recognize it, or the other python versions there, which include python 2.7 etc. The path is /usr/bin . please help, ive been strugling with this for so long now.
Have you tried updating to the newest version of python? If not, try and it should work fine after.
Related
I've tried to upgrade Python version to 3.8 and when I want to add the interpreter in PyCharm I get the following:
I have no idea as to why this happens. When I type python -V in the command prompt I get Python 3.8.3.
EDIT: Python version actually is updated but PyCharm still marks the code as if the version is 3.
I'm trying to make a discord bot, and I read that I need to have an older version of Python so my code will work. I've tried using "import discord" on IDLE but an error message keeps on coming up. How can I use Python 3.6 and keep Python 3.7 on my Windows 10 computer?
i will suggest u using anaconda.
just create new environment named 'py36'
then set python version is 3.6
then run the environment.
if u use pyCharm u can use anaconda's interpreter as the Project's interpreter.
so problem solved.
Just install it in different folder (e.g. if current one is in C:\Users\noob\AppData\Local\Programs\Python\Python37, install 3.6. to C:\Users\noob\AppData\Local\Programs\Python\Python36).
Now, when you'll want to run a script, right click the file and under "edit with IDLE" will be multiple versions to choose. Works on my machine :)
Install in different folder than your old Python 3.6 then update path
Using Virtualenv and or Pyenv
Using Docker
Hope it help!
I have installed PyCharm 2016.3 and installed two version of Python (3.5.2 and 2.7.9) on Windows.
I would like to use both of these version, so I configured it at the Project Interpreter window. I chose the 3.5.2 version like the image below
After that I opened the Python Console, everything works fine with the 3.5.2 version of Python. But when I open the Terminal and press python --version, the version was still not changed.
I couldn't run the server with the statement python manage.py runserver because the project contains some code which could only be ran in Python 3.x, not 2.x.
How can I fix this problem?
PyCharm Terminal is your local system terminal, as it can be seen in the official PyCharm website.
So you need to make sure that your local python, points to the python setup version you want.
For Linux, something like that:
alias python=/usr/local/bin/python3.5
For Windows you may find helpful this discussion.
The terminal which you mention is actually the Windows Command Prompt, so it won't use the settings that you specified in Pycharm. Think of it as a shortcut to the windows cmd.
Regarding the code compatibility between Python 2.x and 3.x, if the developer does use some Python 2.x code alongside Python 3.x code within the same project, then they should import a package known as 'Future', so the Python 2.x syntax works in Python 3.x. If they haven't then you'll need to make the necessary changes...
I installed python3, I can open idle and it says it is running python3.0.1, but when I enter python3 in the terminal (on OSX) I get an error saying 'command not found'. Entering python gets me the 2.x version that came on the computer. Any advice on how I can access python3 from the terminal?
Thanks
First, don't use Python 3.0.1. It has many problems and was officially retired upon the release of Python 3.1 (currently 3.1.2). You can find the python.org Mac OS X installer for 3.1.2 here. Once it is installed, then you need to ensure that the bin directory from the 3.1.2 framework (/Library/Frameworks/Python.framework/Versions/3.1/bin) is on your shell search path. You can manually modify an appropriate shell startup file, like .bash_profile. Or just double-click the Update Shell Profile.command found in /Applications/Python 3.1. In either case, you will need to open a new terminal window or re-login. Another approach is to install Python 3.1 from MacPorts or another distributor. Also, alpha releases of Python 3.2 are now available from python.org and elsewhere.
I used Homebrew to install python, the version is 2.7.10, and the system provided version is 2.7.6. My PATH environment variable is set to /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin", so my terminal DOES know to look at the Homebrew bin folder first!
However, when I run python, it still defaults to 2.7.6, the system provided version (the interpreter that shows up says 2.7.6 at the top). If I run /usr/local/bin/python, it runs 2.7.10, which is what I want.
If my PATH variable is properly set, then how is it possible that terminal still finds /usr/bin/python first?
This happened to me when I installed Python 2.7.10 using brew. My PATH was set to /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin and which python returned /usr/local/bin/python (which is symlinked to Python 2.7.10.)
Problem went away when I closed and restarted Terminal application.