There seems to be a problem when virtualenv is used in PowerShell.
When I try to activate my environment in PowerShell like...
env/scripts/activate
.. nothing happens. (the shell prompt should have changed as well as the PATH env. variable .)
I guess the problem is that PowerShell spawns a new cmd. process just for running the activate.bat thus rendering the changes activate.bat
does to the shell dead after it completes.
Do you have any workarounds for the issue? (I'm sticking with cmd.exe
for now)
To activate the virtual environment, go to the directory where you installed it and run the following command by replacing "env" with your environment name. To install any package make sure the virtual environment is active. Use the following command to install the package.
With your PowerShell command line open, enter python to run the Python 3 interpreter. (Some instructions prefer to use the command py or python3 , these should also work). You will know that you're successful because a >>> prompt with three greater-than symbols will display.
To install virtualenv, just use pip install virtualenv . To create a virtual environment directory with it, type virtualenv /path/to/directory . Activating and deactivating the virtual environment works the same way as it does for virtual environments in Python 3 (see above).
The latest version of virtualenv supports PowerShell out-of-the-box.
Just make sure you run:
Scripts\activate.ps1
instead of
Scripts\activate
The latter will execute activate.bat
, which doesn't work on PowerShell.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With