I used the command below to upgrade to python3.7
But when I control the python version, it is still python 2.7.
How should I do?
Have a look at the instructions provided in this answer:
Then you would just call Python like so:
python3.7 ./yourScript.py
Do not forget to use python3.7 instead of python.
Related
I tried using select python interpreter and chose my virtualenv using python3 but when I use print(sys.version) on the file I create in vs code, I still get python 2.7. What am I doing wrong?
I have installed Anaconda on Windows 7 from the full installer and then created an Anaconda Python 3 environment (py3k) using conda. From my reading of the installation instructions at
http://continuum.io/blog/anaconda-python-3
I type activate py3k at the Anaconda command prompt to obtain that environment and in the Command Prompt window it says
[py3k] C:\users.. etc
which would appear to indicate that I am, in fact, in a Python 3.X environment. However, when I type 'Python' at the prompt I get
Python 2.7.5 | Anaconda ... etc
Am I still in a Python 3.X environment or have I omitted to do something installation-wise or otherwise?
have you tried unset PYTHONPATH, and which python?
If you do that after activating py3, you should be able to the python 3 interpreter. If not, what do you get after executing which python?
I have already check Sympy.org website and the following link. But I didn't find any executable file to install the Sympy on Python 3.3.
http://code.google.com/p/sympy/downloads/list
Sorry, we never got bdist_wininst working in Python 3. You'll need to install from source.
I have both 2.7 and 3.0 versions of the Python interpreter installed (on my Ubuntu 32 system), but one particular script uses 3.0.
Using
#!/usr/bin/python3 -B
will not work when the program is run with python myprogram.py.
And I also need a solution that works also in Windows where I also have both python versions installed.
How can I make the script to run only with the right python version?
Please use virtualenv, which makes isolated Python environments easy.
python = Python to use. # This has to be the absolute path to Python executable
os.execl(python, python, * sys.argv)
This way you can restart the script with the python you want to use. Not really stylish.
I don't know why you can't just launch the program with python3 foo.py, but it's possible to have a python2 program relaunch itself as python3 with something like this.
import sys
if sys.version_info.major != 3:
import os
# replace this process with a python3 process
os.execlp("python3", "python3", *sys.argv)
It's a bad solution though, because now your python3 program can't use anything that's not valid python2 syntax
Please take a look at The wrong python interpreter is called
You have to choose a correct interpreter based on where you installed the desired version of Python and your system variables.
I'm moving on up to Python 3, but can't seem to find an IPython release for it. The main IPython release page doesn't list anything appropriate. Any help in getting IPython working for Py3k would be much appreciated.
See the ipython dev mailing list
EDIT : see the Ipython 3 page - where now (Jan 2011) it says there is a version for python 3 in source code version only
EDIT: and now iPython supports python 3 directly.
Python 3 support has been around for a fairly long time now. You don't need a different version. IPython supports modern versions of Python 2 and 3. You just run IPython with the appropriate interpreter, python3 ipython.py. You can install IPython on Python3 by running setup.py with your Python3 interpreter.