I created a virtualenv around my project, but when I try to activate it I cannot. It might just be syntax or folder location, but I am stumped right now.
You can see
For activation you can go to the venv
your virtualenv directory
by cd venv
.
Then on Windows, type dir
(on unix, type ls
).
You will get 5 folders include
, Lib
, Scripts
, tcl
and 60
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.
If you are using windows OS then in Gitbash terminal use the following command $source venv/Scripts/activate. This will help you to enter the virtual environment.
For windows, type "C:\Users\Sid\venv\FirstProject\Scripts\activate" in the terminal without quotes. Simply give the location of your Scripts folder in your project. So, the command will be location_of_the_Scripts_Folder\activate.
source
is a shell command designed for users running on Linux (or any Posix, but whatever, not Windows).
On Windows, virtualenv creates a batch file, so you should run venv\Scripts\activate
instead (per the virtualenv documentation on the activate script).
Edit: The trick here for Windows is not specifying the BAT extension:
PS C:\DEV\aProject\env\Scripts> & .\activate
(env) PS C:\DEV\aProject\env\Scripts>
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\Scripts\activate
You can check it via spider tool in anaconda by typing import tensorflow as tf
If you see the 5 folders (Include
,Lib
,Scripts
,tcl
,pip-selfcheck
) after using the virtualenv yourenvname
command, change directory to Scripts
folder in the cmd itself and simply use "activate" command.