Ebram Shehata
Ebram Shehata

Reputation: 621

python virtualenv is not being activated

OS: Lubuntu 16.04

I installed python virtual environment using: sudo pip3 install virtualenv after that I created a new virtualenv using: virtualenv -p python3 env3

Already using interpreter /usr/bin/python3
Using base prefix '/usr'
New python executable in /some_path/env3/bin/python3
Also creating executable in /some_path/env3/bin/python
Installing setuptools, pip, wheel...done.

Then whenever I try to activate the environment, nothing happens! I used: ./env3/bin/activate and nothing happens after that. I read that when an environment is activated it is added to the prompt to be something like:

(environment_name) me@machine:/some_path$

But nothing happens when I try to activate it. I thought it might just be something wrong with prompt GUI but when I try: deactivate the result is: deactivate: command not found which means the environment is not activated. I also tried: sudo ./env3/bin/activate and source /env3/bin/activate but nothing worked :( .

Upvotes: 0

Views: 1773

Answers (1)

northtree
northtree

Reputation: 9285

The command is . env3/bin/activate or source env3/bin/activate

➜  venv_example virtualenv -p python3 env3
Running virtualenv with interpreter /usr/local/bin/python3
Using base prefix '/usr/local/Cellar/python3/3.6.2/Frameworks/Python.framework/Versions/3.6'
New python executable in /Users/.../venv_example/env3/bin/python3.6
Also creating executable in /Users/.../venv_example/env3/bin/python
Installing setuptools, pip, wheel...done.

➜  venv_example ls
env3
➜  venv_example . env3/bin/activate
(env3) ➜  venv_example   

Upvotes: 3

Related Questions