Python Forum
I seem to have two versions of python 3.7.9 installed
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
I seem to have two versions of python 3.7.9 installed
#6
You can ask python to where it points. For example in my kubuntu 16.04,
λ python3
Python 3.5.2 (default, Oct  7 2020, 17:19:02) 
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.executable
'/usr/bin/python3'
By the way, what about installing packages from within Python itself? You would be certain that they are installed for the current interpreter.
import subprocess as sp
import sys

def install_package(name):
    sp.call([sys.executable, '-m', 'pip', 'install', '-U', '--user', name])


if __name__ == '__main__':
    install_package('requests')
miner_tom likes this post
Reply


Messages In This Thread
RE: I seem to have two versions of python 3.7.9 installed - by Gribouillis - Nov-22-2020, 09:56 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Installing mailjet_rest for Python 3 while Python 2 is installed gw1500se 0 114 Jun-12-2024, 06:23 AM
Last Post: gw1500se
  Python Launcher (on Windows) only necessary when 2 or more Python versions installed? pstein 1 457 Feb-17-2024, 12:43 PM
Last Post: deanhystad
Question log.exception() without arguments in old Python versions? cthart 5 1,325 Nov-19-2022, 07:09 PM
Last Post: Gribouillis
  Python versions with libexpat fixes raghupcr 5 2,751 Feb-24-2022, 06:26 PM
Last Post: raghupcr
  Installed versions of Python SamHobbs 5 2,695 Sep-02-2021, 02:28 PM
Last Post: jefsummers
  Different versions of Python3 and Python Led_Zeppelin 2 2,428 Jun-16-2021, 05:31 AM
Last Post: snippsat
  Python Versions ThatTamyBot 2 2,797 Mar-11-2021, 11:27 AM
Last Post: ThatTamyBot
  pip list to show all versions of a package installed pvbadiger05b 4 2,681 May-21-2020, 06:48 PM
Last Post: jameshonest
  Package installed through Anaconda "not found" by Python zonova 0 2,399 May-08-2020, 11:50 PM
Last Post: zonova
  How to change directory to any folder where python is not installed ? firashelou 4 2,731 Apr-03-2020, 02:43 PM
Last Post: firashelou

Forum Jump:

User Panel Messages

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