2

python 3.7.1 Windows 10 Powershell

Steps taken:
create folder for envs
change to folder
pip install virtualenv virtualenv "abc"
abc\Scripts\activate

This throws the error stated in the title. I have tried activate and activate.ps1. They both result in the error. activate.bat doesn't get the error but it doesn't work either.

I have tried running PS as administrator and searched google and stackoverflow. Myself and one other user on stackoverflow seem to be the only two people with this problem.

Details:

Output from activate.ps1:

PS D:\GoogDrive\flask> noc\Scripts\activate.ps1  
You must 'source' this script: PS> . noc\Scripts\activate.ps1  
PS D:\GoogDrive\flask>  

Output from activate.bat:

PS D:\GoogDrive\flask> noc\Scripts\activate.bat  
PS D:\GoogDrive\flask>  

Also, when I do pip list, it always shows me all the modules in my base install.

tripleee
  • 3,308
  • 5
  • 36
  • 35
bsbaixo
  • 23

1 Answers1

4

Like the error message specifically says, the correct way to run the script is to source it:

. noc\Scripts\activate.ps1

The single dot is an alias for the source command. This causes the script to be run in the current session, rather for the shell to start a new subshell, run the script, and exit (thus losing any environment changes that the script attempted to make).

tripleee
  • 3,308
  • 5
  • 36
  • 35