Python Forum
Best practice on using virtual environments in Python
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Best practice on using virtual environments in Python
#6
(Feb-13-2024, 12:32 AM)snippsat Wrote:
(Feb-12-2024, 11:40 PM)bytecrunch Wrote: Thank you. But after you create a virtual environment and also activated it,
VS Code, PyCharm will detect the environment or just choice from a list of Interpreter.
Example.
# Make 
G:\div_code
λ python -m venv my_env
# cd in
λ cd my_env\
# Activate
λ G:\div_code\my_env\Scripts\activate
# Start VS Code
G:\div_code\my_env
(my_env) λ code .
As i start VS Code from environment,it will usually auto detect the environment,see 3.12('my_env': venv).
This work the the same for Anaconda/Miniconda as you have ask about before,
also poetry(stable mature now) is good choice if making a package(share on eg PyPi).
[Image: Yy5aq8.png]

Great! Thank you. All clear now: enter the activated environment and launch the IDE, like VS code....I am sure we can go the other way: launch VS code and activate the virtual environment from the VS Code terminal...which is also a terminal...

What is different between the VS Code terminal and the regular Windows terminal like CMD or Powershell?

Jupyter notebook, another IDE, has these things call kernels that makes things less clear. Jupyter is a client-server application that runs on a single machine locally. What is the kernel about in this case?
Reply


Messages In This Thread
RE: Best practice on using virtual environments in Python - by bytecrunch - Feb-13-2024, 11:17 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Windows, Linux and virtual environments Calab 2 512 Mar-07-2025, 10:43 PM
Last Post: snippsat
  Python use of virtual environments bre67e49 4 823 Feb-19-2025, 04:01 AM
Last Post: Sece1967
  I cannot create a virtual environment on visual studio code using python Willem_Aucamp316 2 3,732 Nov-27-2024, 02:20 PM
Last Post: menator01
  Best programming practice for imports Curbie 8 1,791 Oct-16-2024, 02:20 AM
Last Post: Curbie
  how can I organise my code : best practice? pythonbum 0 616 May-24-2024, 03:17 PM
Last Post: pythonbum
  Virtual Env changing mysql connection string in python Fredesetes 0 1,017 Dec-20-2023, 04:06 PM
Last Post: Fredesetes
  Installing python packages in a virtual environment Led_Zeppelin 1 1,662 Aug-15-2023, 08:18 PM
Last Post: deanhystad
  Virtual Environments - Organization (VS Code) JaysonWonder 11 4,028 Jan-26-2023, 11:34 PM
Last Post: Larz60+
  Keeping up with IDEs and Virtual Environments... bytecrunch 7 7,296 Sep-05-2022, 08:04 PM
Last Post: snippsat
  I don't understand pip and environments snakes 3 2,242 Jul-31-2022, 08:17 PM
Last Post: snakes

Forum Jump:

User Panel Messages

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