skip to Main Content

So, i have python 3.11 installed, i wanted to run a code with flask module, and it was running using original python, but not in vscode, so i followed a suggestion from stack exchange and used command python -m venv env.
This created a new folder called env, and after that i got a prompt that new virtual environment has been created, do you want to use it for the workspace folder, i said yes, and still nothing worked. And now even other modules are not being recognized either by vscode or the original python.exe.
I am a novice in programming and have no idea what to do, please help.
Thanks

2

Answers


  1. Once a venv is created, you must activate it like so: C:Uservenv_folderScripts activate

    If this doesn’t work try using C:Uservenv_folderScripts activate.ps1 or activate.bat

    You’ll know if it works once you have the (venv_name) before your command line in the terminal

    Login or Signup to reply.
  2. python -m venv env

    According to the docs. Running this command creates the target directory (creating any parent directories that don’t exist already) and places a pyvenv.cfg file in it with a home key pointing to the Python installation from which the command was run (a common name for the target directory is .venv). It also creates a bin (or Scripts on Windows) subdirectory containing a copy/symlink of the Python binary/binaries (as appropriate for the platform or arguments used at environment creation time). It also creates an (initially empty) lib/pythonX.Y/site-packages subdirectory (on Windows, this is Libsite-packages). If an existing directory is specified, it will be re-used.

    I think what you need more is to create a conda environment. Use the following command to create it (take python 3.10.4 as an example), and then you can manually select it in python interpreter.

    conda create -n env-01 python=3.10.4
    

    enter image description here

    You can also read vscode docs for more details.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search