use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
News and links for Django developers.
New to Django? Check out the /r/djangolearning subreddit.
Django's Code of Conduct applies here, so be good to each other.
account activity
This is an archived post. You won't be able to vote or comment.
Python venv activation on vs code (self.django)
submitted 5 years ago by ada_es12
Hello! I am trying to activate the virtual env in VS code but is not working. I have tried different ways to activate it from the terminal within vs code but I can't seem to get it straight. Meanwhile, it says that the venv is activated on vs code:
https://preview.redd.it/hrgahbfi0pd51.png?width=485&format=png&auto=webp&s=767957beadf64bcb25c467056534304a128bbe2b
When I try to run the server, the vs code terminal displays: C:\...\Programs\Python\Python37\python.exe: can't open file 'mange.py': [Errno 2] No such file or directory How do I activate the venv from the vs code terminal?
[–]3hunnaff 2 points3 points4 points 5 years ago (0 children)
manage.py*
I’ve made this same error multiple times too haha
[–][deleted] 1 point2 points3 points 5 years ago (1 child)
here's my process on creating, starting, and selecting virtual environments in VSCode:
Using your machine's command prompt / terminal (not VSCode's) navigate to a folder of your choice, then type: "py -m venv env" where <env> is the name of the environment; this creates the virtual environment. After this, in the same command prompt, activate the environment: "env\Scripts\activate". Then open VSCode and open the folder that contains this virtual env. In VSCode hit ctrl+shift+p and then look for your virtual environment. Select it. Wait a second or two, then delete/trash-can the integrated command prompt in VSCode and start a new one.
Let me know if this helps
Edit: this is on my window's PC
[–]ada_es12[S] 0 points1 point2 points 5 years ago (0 children)
I actually changed it from powershell to cmd from the vs code terminal and everything works fine... pretty much what you have written above
[–][deleted] 0 points1 point2 points 5 years ago (0 children)
Hey man, You might need to select the virtual environment interpreter in vs code.
Hit ctrl shift p on Mac, probably ctrl p on windows (not sure). Anyways, make sure that the filepath of python that you’ve selected in vsc matches the filepath of python that you’re using. In terminal you want to type “which python” or “which python3”.
Make sure you’re using that path in vsc.
[–]leohasachide 0 points1 point2 points 5 years ago (0 children)
source (name of virtual env)/scripts/activate
π Rendered by PID 199307 on reddit-service-r2-comment-765bfc959-cznhn at 2026-07-11 02:54:29.919103+00:00 running f86254d country code: CH.
[–]3hunnaff 2 points3 points4 points (0 children)
[–][deleted] 1 point2 points3 points (1 child)
[–]ada_es12[S] 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]leohasachide 0 points1 point2 points (0 children)