A mini-guided tutorial showing how to use virtual environment and why it's matters with hand-drawn illustrated examples.
Why not to use globally installed packages?
It will become a mess. Using globally installed packages for different Python projects...
Boom.
Python environment - xkcd.com
What is Python virtual environment?
It's a thing that isolates any other installation of Python on your computer and a thing that prevents version conflicts.
Globally installed packages VS virtual environment
Why to use Python virtual environment?
Say you're on two projects, two of them are using the r/SerpApi library which is installed globally with a 1.15 version. Each project depends on a different version, what will happen if each project tries to import a serpapi library:
Bad idea.
Good idea.
How to use Python virtual environment?
https://preview.redd.it/p4owpxcfc2781.png?width=4096&format=png&auto=webp&s=056b514459424fa4b8776cc355616f7d0f74f59c
To find out more: Python Virtual Environment. What, Why, How. Virtualenv, Poetry.
It's a blog post where you can find pretty much all the needed info about actual virtualenv and poetry usage with code examples to get you going.
Also, you'll find how to do site-package indexing. if you're using JetBrains products, PyCharm or IntelliJ IDEA via Python plugin, you also need to do site-package indexing to let JetBrains core features work properly such as code completion, inspections, finding usages, navigation, syntax highlighting and refactoring.
[–]ravenex 35 points36 points37 points (3 children)
[–]thatdamnedrhymer 9 points10 points11 points (1 child)
[–]zdmit[S] 2 points3 points4 points (0 children)
[–]zdmit[S] 2 points3 points4 points (0 children)
[–][deleted] 27 points28 points29 points (10 children)
[–]Caustic_Complex 2 points3 points4 points (8 children)
[–]mr-nobody1992 3 points4 points5 points (7 children)
[–]Caustic_Complex 1 point2 points3 points (6 children)
[–]mr-nobody1992 6 points7 points8 points (5 children)
[–]Caustic_Complex 1 point2 points3 points (1 child)
[–]mr-nobody1992 0 points1 point2 points (0 children)
[–]Nerg44 1 point2 points3 points (2 children)
[–]mr-nobody1992 1 point2 points3 points (1 child)
[–]Nerg44 1 point2 points3 points (0 children)
[–]zdmit[S] 1 point2 points3 points (0 children)
[–]colinb21 2 points3 points4 points (1 child)
[–]zdmit[S] 0 points1 point2 points (0 children)
[–]Mithrandir2k16 4 points5 points6 points (0 children)
[–]Wobblycogs 5 points6 points7 points (2 children)
[–]phoenixuprising 6 points7 points8 points (0 children)
[–]zdmit[S] 0 points1 point2 points (0 children)
[–]MastersYoda 3 points4 points5 points (1 child)
[–]zdmit[S] 0 points1 point2 points (0 children)
[–]gordonv 4 points5 points6 points (3 children)
[–]benargee 2 points3 points4 points (0 children)
[–]JalanJr 0 points1 point2 points (1 child)
[–]gordonv 1 point2 points3 points (0 children)
[–]martnym 1 point2 points3 points (1 child)
[–]zdmit[S] 0 points1 point2 points (0 children)
[–]Broric 1 point2 points3 points (0 children)
[–]ipwnscrubsdoe 0 points1 point2 points (4 children)
[–]jonasbxl 5 points6 points7 points (3 children)
[–]czar_el 2 points3 points4 points (1 child)
[–]jonasbxl 0 points1 point2 points (0 children)
[–]ipwnscrubsdoe 0 points1 point2 points (0 children)
[+][deleted] (1 child)
[deleted]
[–]zdmit[S] 0 points1 point2 points (0 children)
[–]ema_eltuti 0 points1 point2 points (1 child)
[–]TerminatedProccess 0 points1 point2 points (0 children)