Python Forum
I don't understand pip and environments
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
I don't understand pip and environments
#4
Thank you for the replies.

I managed to uninstall Python 3.10 from the Mac and although pip doesn't work pip3 does. It kind of did before I uninstalled 3.10 but "pip3 list" was empty. Now it's full. I think that thing is going to be on eBay soon! No more coding on the Macbook.

Back to Linux though... I don't seem to have Python2 installed and in VSCode I only have the option for 3.6.15. Both "pip -V" and "pip3 -V" return "pip 20.0.2 from /usr/lib/python3.6/site-packages/pip (python 3.6)". Does this mean it doesn't matter which one I use or is there a difference?

I still don't understand virtual environments though. I'm going through all these motions now because I've recently reinstalled my OS so I'm using a clean slate and I hate blasting lots of install code into the terminal until something works. I like to keep my OS as lean as possible.

An example of why I'm confused... I wrote some code that uses tkcalendar. It wouldn't run because I don't have the module installed. "pip install tkcalendar" and then it worked. I then uninstalled tkcalendar and it didn't work, obviously. I then setup a virtual environment in the directory my .py file is in, activated the environment and installed tkcalendar again. ...fired up VSCode, ran the code and "ModuleNotFoundError: No module named 'ttkthemes'". So I still don't understand how they work.

How do you make use of the environment?

Also, if I get my head around how to use modules installed in an environment I guess installing different versions of Python will work the same?

Sorry for the elementary questions! I just glazed over this stuff when it popped up in a book I was reading but I'm beginning to realise it's important!

EDIT: Got it! The virtual environment is selectible in VSCode. Sorry!
Reply


Messages In This Thread
I don't understand pip and environments - by snakes - Jul-31-2022, 09:14 AM
RE: I don't understand pip and environments - by snakes - Jul-31-2022, 08:17 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Best practice on using virtual environments in Python bytecrunch 6 956 Feb-14-2024, 03:22 PM
Last Post: snippsat
  Virtual Environments - Organization (VS Code) JaysonWonder 11 1,967 Jan-26-2023, 11:34 PM
Last Post: Larz60+
  Keeping up with IDEs and Virtual Environments... bytecrunch 7 2,613 Sep-05-2022, 08:04 PM
Last Post: snippsat
  Use different Anaconda environments on Linux Mint and Spyder StaLLoNe_CoBRa 0 1,910 Jan-20-2021, 03:12 AM
Last Post: StaLLoNe_CoBRa
  pip and venv virtual environments soupworks 2 2,326 Dec-30-2020, 11:38 PM
Last Post: soupworks
  Virtual Environments pneveux 1 1,859 Apr-04-2019, 09:15 PM
Last Post: Larz60+
  Embedding, windows, and virtual environments mariofutire 0 3,070 Sep-14-2018, 10:30 AM
Last Post: mariofutire
  Different Virtual environments Pengwain 1 2,428 Jul-08-2018, 02:48 PM
Last Post: snippsat
  Installing blpapi in two different conda environments snicolaou 0 4,028 Jan-09-2018, 02:12 PM
Last Post: snicolaou

Forum Jump:

User Panel Messages

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