Python Forum
Help with creating folder and "virtual environment"
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help with creating folder and "virtual environment"
#1
Hi

I want to make use of GitHub-programs, and so I downloaded a bunch of Python-tools.

When I run this command in "Python 3.12", which looks like CMD to me, I get a syntax error.

"To create a virtual environment, Python supplies a built in venv module which provides the basic functionality needed for the virtual environment. Running the command below will create a virtual environment named "openai-env" inside the current folder you have selected in your terminal / command line:

python -m venv openai-env"

First of all, the instructions said nothing about "selecting" a folder, and I have no idea how to do that, so maybe that´s what´s going on. It says it´s included in the program, so..

Any clue?
Reply
#2
This command:
python -m venv openai-env
Is run in a shell (like CMD or powershell in windows), it is not run inside a python shell.

Running this command will create a folder named openai-env in the current working directory. The folder will contain a partial copy of your Python 3.12 distribution.

To use the virtual environment it has to be activated. This can be done different ways, and these are probably discussed in the same document that describes how to make a virtual environment. I do all my python development using Visual Studio Code (or VSCode). When I start a new Python project I create a virtual environment that is associated with the project. When I open the project in VSCode, VSCode automatically activates the virtual environment. Most IDE's doe something similar. You can also activate your virtual environment by executing the activate.bat file in (for your example) openai-env\Scripts.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Compare folder A and subfolder B and display files that are in folder A but not in su Melcu54 3 566 Jan-05-2024, 05:16 PM
Last Post: Pedroski55
  Installing python packages in a virtual environment Led_Zeppelin 1 775 Aug-15-2023, 08:18 PM
Last Post: deanhystad
  Problem with virtual environment standenman 2 1,015 Feb-23-2023, 07:09 PM
Last Post: standenman
Question Virtual Environment (using VS Code) Ashcora 4 14,137 Feb-15-2023, 07:17 PM
Last Post: snippsat
  How do I link the virtual environment of that project to the 3.9.2 version of python? Bryant11 1 1,381 Feb-26-2022, 11:15 AM
Last Post: Larz60+
  Project structure with a virtual environment gdbengo 1 1,449 Jan-26-2022, 03:22 PM
Last Post: snippsat
  Compare filename with folder name and copy matching files into a particular folder shantanu97 2 4,509 Dec-18-2021, 09:32 PM
Last Post: Larz60+
  pyspark creating temp files in /tmp folder aliyesami 1 5,026 Oct-16-2021, 05:15 PM
Last Post: aliyesami
  Virtual environment path? Led_Zeppelin 1 2,315 Jul-22-2021, 01:40 PM
Last Post: snippsat
  virtual environment heye 4 2,484 Jul-04-2021, 06:47 AM
Last Post: ndc85430

Forum Jump:

User Panel Messages

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