'virtualenv to path on Windows 10
I have installed virtualenv (if I type "pip list" there is virtualenv (15.1.0)) and when I try to use it throws an error:
virtualenv : The term 'virtualenv' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again
At line:1 char:1
+ virtualenv + ~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (virtualenv:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException
I think I need to add virtualenv to path, which I've tried without success.
Solution 1:[1]
To install :
pip install --user virtualenv
To create a virtual environment (venv):
python -m virtualenv venv
To activate:
-cd venv
-cd Scripts
-activate.bat
to deactivate:
-deactivate.bat
to run venv again just type activate.bat
Note: had problems with the platformio integrated terminal, used cmd from within the folder. Hope this helps!
Solution 2:[2]
create a virtual environment
python -m virtualenv demoEnv
Activate the environment
demoEnv\Scripts\activate
To deactivate
deactivate
Solution 3:[3]
PS> python -m venv venv
If you’re using Python on Windows and you haven’t configured the PATH and PATHEXT variables, then you might need to provide the full path to your Python executable:
PS> C:\Users\Name\AppData\Local\Programs\Python\Python310\python -m venv venv
Activate It
PS> venv\Scripts\Activate
(venv) PS>
Install Packages Into It
(venv) PS> python -m pip install <package-name>
Deactivate It
(venv) PS> deactivate
PS>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | sidgate |
Solution 2 | anubhab |
Solution 3 | Mushfiqur Rahman |