Python Forum
Different versions of Python3 and Python
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Different versions of Python3 and Python
#1
I am confused about something that is very simple(or should be). You can see from the code below that:

Output:
(base-dup) C:\Users\james\Downloads>python -V Python 3.8.10 (base-dup) C:\Users\james\Downloads>python3 -V Python 3.9.5


I do not have python 2 on my system, but I do have python 3. I thought I had one version and python -V and python3 -V would give the same response. In the case above they do not. I have python 3.95 and 3.8.10. I am not sure how this happened, but I would feel a lot better, if they were the same version. That is how I set up the system originally.

What happened and how o fix?

Respectfully,

LZ
Reply
#2
There is a very elegant solution. Use pyenv, then you can have as many versions of python as you wish.
Each project will have it's own virtual environment that can use any of the loaded versions, controlled by you when project is created. Then whenever the project is activated the proper version will automatically come up.

see: pyenv Simple Python Version Management
Reply
#3
When you do python3 -V it call a version outside of environment.
Test with python3 -c "import sys; print(sys.executable)"
In environment is there only python that count and should be used never python3(or at all on Windows).

Just make a new environment that is updated,this of course one the strong point of using MiniConda.
conda create -n my_env pandas matplotlib JupyterLab spyder python=3.9.5 
A example run:
After this my_env can by my main enviroment it's now updatet with new Python 3.9.5 and Spyder and JupyterLab .
When in environment (my_env) is active and use python will always use Python 3.9.5 from enviroment.
(my_env) C:\Users
λ cd ..

(my_env) C:\
λ python -V
Python 3.9.5

# By doing this see which python that used
(my_env) C:\
λ python -c "import sys; print(sys.executable)"
G:\miniconda3\envs\my_env\python.exe

(my_env) C:\
λ pip -V
pip 21.1.2 from G:\miniconda3\envs\my_env\lib\site-packages\pip (python 3.9)\
@Larz60+ remember that he use Windows then pyenv dos not work,there are fork that work for Windows but i would not bother with it.
What i show over is a powerful way to handle as many version of Python you want on Windows.
Larz60+ likes this post
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Python Launcher (on Windows) only necessary when 2 or more Python versions installed? pstein 1 317 Feb-17-2024, 12:43 PM
Last Post: deanhystad
Question log.exception() without arguments in old Python versions? cthart 5 1,153 Nov-19-2022, 07:09 PM
Last Post: Gribouillis
  Python versions with libexpat fixes raghupcr 5 2,480 Feb-24-2022, 06:26 PM
Last Post: raghupcr
  Installed versions of Python SamHobbs 5 2,506 Sep-02-2021, 02:28 PM
Last Post: jefsummers
  Python Versions ThatTamyBot 2 2,683 Mar-11-2021, 11:27 AM
Last Post: ThatTamyBot
  I seem to have two versions of python 3.7.9 installed miner_tom 7 4,436 Nov-22-2020, 06:42 PM
Last Post: miner_tom
  How many Python versions do I need? kenatsun 3 2,590 Jan-05-2020, 03:54 AM
Last Post: ichabod801
  python and py report different versions lordvold 3 2,641 Nov-27-2019, 11:01 PM
Last Post: lordvold
  Gnuradio python3 is not compatible python3 xmlrpc library How Can I Fix İt ? muratoznnnn 3 4,895 Nov-07-2019, 05:47 PM
Last Post: DeaD_EyE
  Changing Python Versions in Ubuntu 16.04 ErnestTBass 2 3,127 Jan-10-2019, 05:45 PM
Last Post: metulburr

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020