The Python Oracle

Issue with virtualenv - cannot activate

Become part of the top 3% of the developers by applying to Toptal https://topt.al/25cXVn

--

Track title: CC D Schuberts Piano Sonata D 850 in D

--

Chapters
00:00 Question
01:20 Accepted answer (Score 528)
01:59 Answer 2 (Score 46)
02:17 Answer 3 (Score 41)
02:55 Answer 4 (Score 35)
03:38 Thank you

--

Full question
https://stackoverflow.com/questions/8921...

Accepted answer links:
[documentation on the activate script]: https://virtualenv.pypa.io/en/legacy/use...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#python #virtualenv

#avk47



ACCEPTED ANSWER

Score 605


source is a shell command designed for users running on Linux (or any Posix, but whatever, not Windows).

On Windows, virtualenv creates a .bat/.ps1 file, so you should run venv\Scripts\activate instead (per the virtualenv documentation on the activate script).

Just run activate, without an extension, so the right file will get used regardless of whether you're using cmd.exe or PowerShell.




ANSWER 2

Score 70


I had the same problem. I was using Python 2, Windows 10 and Git Bash. Turns out in Git Bash you need to use:

 source venv/Scripts/activate



ANSWER 3

Score 45


I was also facing the same issue in my Windows 10 machine. What steps i tried were:

Go to andconda terminal Step 1

pip3 install -U pip virtualenv

Step 2

virtualenv --system-site-packages -p python ./venv

or

virtualenv --system-site-packages -p python3 ./venv

Step 3

.\venv\activate

You can check it via spider tool in anaconda by typing import tensorflow as tf




ANSWER 4

Score 39


  1. For activation you can go to the venv your virtualenv directory by cd venv.

  2. Then on Windows, type dir (on unix, type ls). You will get 5 folders include, Lib, Scripts, tcl and 60

  3. Now type .\Scripts\activate to activate your virtualenv venv.

Your prompt will change to indicate that you are now operating within the virtual environment. It will look something like this (venv)user@host:~/venv$.

And your venv is activated now.