[Ex 46] About activating the virtual environment

When I try to set up a virtual environment and activate it, the powershell give me a warning –
“You must ‘source’ this script: PS> . …venvs\lpthw\Scripts\activate”

I don’t know what is wrong. I search the Internet but I only found someone met the same problem (still unsolved).

I have already set the script execution policy to ‘unrestricted’. But it doesn’t work.
The other steps are just the same as those in the books.

1 Like

Hello, I also had this same problem.
I found a solution here in my post: A note for Exercise 46 - LP3THW

Might be worth trying.

Kind regards

1 Like

Thanks a lot. I will try it.

1 Like

Awesome, let me know if it worked or not!

Thanks for your help. But when I was trying to install virtualenv version 15.1.0, some error occured.

Therefore, this way is dead for me.

But I tried some other ways and one works. Here is the link but the blog is in Chinese. I’m not sure whether you can understand it.

What it mainly talks about is that when the error “You must ‘source’ this script: PS> . .\scripts\activate” occurs, you can simply solve it by adding '. ’ ahead of the original command (please note it is a full stop and a blank space). I tried and it worked.

1 Like

That’s fantastic, I’m glad you got it solved!

I did orginally try it the way you mentioned, however, on PowerShell I could not get it to source with the latest version of virtualenv. I am glad that it seems to have worked for you, however.

No idea why it could not install version 15.1.0, but at least you have now activated the virtual environment.

Thank you for getting back to me!

1 Like

Ohhhhhhhhhhh, you were probably typing:


But you need the space after that first . which you can’t quite see in the typography.

Yes,exactly! But I still didn’t figure out the mechanism behind this.

The mechanism is a bunch of crusty Unix people decided . would mean source and that’s all there is to it. … now has a totally different meaning from . [space] . and it’s historical.

1 Like