Here's how you can setup a virtual environment in Visual Studio Code for Python. ▶ Become job-ready with Python: www.indently.io ▶ Follow me on Instagram: / indentlyreels
For those that didn't get the venv after restarting the terminal and had an error regarding to Execution Policies, just run in the terminal the following script: Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser and then: .\.venv\Scripts\activate (for Windows)
It has taken me hours to import modules in python but after following this, I can firmly say that I have landed. Btw am a self taught programmer/coder and this was really helpful.😊
for those that did not get the (env name) in terminal path, which is supposed to be displayed in the panel after activation, its normal on Vs code right now. You can hover over the powershell or cmd button on the top of the panel to see the extensions that have contributed to the terminal environment. There you will see your virtual env running.
Now the dozens of videos I've watched regarding installing Autogen and memgpt etc make sense!! thank you. I've been using conda environments and have had a difficult time finding the and editing the correct .py files! for packages and running them.
wow I wasted so many hours trying to figure out what the hell was going on before finally finding this video and solving it in seconds, thanks man I appreciate it!
Why the « pip install discord » int he folder didnt work but it worked in the venv environment ? Is it because of some conflict with other global python packages?
actually when creating a new python file, if you create a requirements.txt under it and add modules to be used, vscode displays a button on the bottom left side asking you whether you want to create a new environment
I just keep getting an error when trying to run the virtual environment command- Python was not found; run without arguments to install from the Microsoft Store,
for windows .... python -m venv myenv Then activate it by following command... myenv\Scripts\activate here .... myenv is name of my environment .... u can give any name ..... Just 2 lines of Commands..
Thank you very much for the very informative video. So i assume if you wanted to set up several virtual environments for different projects, you would just name them differently in the .venv command. Thanks again
My VS code lets me use pip outside of a venv and when I look online it seems to be normal for pip to work outside a venv. Is there a reason why it should not be working like in the video? Im using windows.
i`m having a problem with the venv on the windows. Everytime that I reopen the project, like the next day, I have to reactivate the virtual enviroment. Is that correct? Do I have another way to do it? what I`m doing is opening the cmd on the folder and then running "code . " to open vscode with the right directory. then I have to go and put the "Set-ExecutionPolicy Unrestricted -Scope Process" and then ".\ .venv\Scripts\activate" everytime. What am I doing wrong? or is that normal ? PLease
Hello, i'm creating a new folder named 'folder', and then following this step. But why after print('Hello!'), and text 'pip install discord' in vscode terminal, my vscode install discord? as i see in this video, there must be command not found: pip, but that's not happened in my vscode..
What happens when I run the .py program on another machine, do I need the pip package I installed in the virtual environment or once written I won’t need the pip package?
why does the visual studio website says do not use the virtual environment same as a workspace folder? in your video you selected it as yes to use as a workspace folder
how would one upgrade the phyton in a virt environment? thanks? for instance my system wide python says it is 3.11.3 but my venv says it is 3.7. wld be grateful for any help or signposting
Why is my vscode only running 1 line of code inbased off my cursor, why i cant run all of them at once. i have to drag it then runnit, can you helpp? i used Conda env the 1st time then i used venv env . but its still do that. thank you
So are you supposed to have seperate venv folders for each project? Isnt that inecfficient as you would need multiple pip installations of the same basic things? Also would this work with git and uploading to github to work across multiple machines?
No, you can run multiple project from one virtual environment, 1- just use terminal to activate you're old virtual env from the old path. 2-don't forget two change the interpreter to the old virtual env, you can import anything using one venv. you just need to creat new venv when an library's update is needed so you don't corrupt your old project that are using old lib versions.
what do I do if I failed a couple times, tried again by deleting the .venv files and now no longer get the notification or the option to use the venv folder??
I'm a bit late but you can click on the interpreter data on the bottom-right of the window that should be called like the version of python that is installed on your computer. Then you can click at the top on "browse..." then you go in the .venv folder then scripts and python.exe
What if we do not get that pop-up? I am not convinced I have launched a virtual environment. Any advice for this code from Coursera? if [ -d "$HOME/.local/bin" ] ; then PATH="$HOME/.local/bin:$PATH" fi pipenv shell pipenv install