pylonicon
pylonicon

Reputation:

How come I can not activate my Virtual Python Environment with 'source env/bin/activate' command?

I am trying to activate my Virtual Python Environment to use with Pylons but I think I am executing the commands wrong.

jem@jem-laptop:~$ source env/bin/activate
bash: env/bin/activate: No such file or directory

What am I doing wrong? How should I do it right?

Upvotes: 28

Views: 99847

Answers (9)

Samanja Cartagena
Samanja Cartagena

Reputation: 148

It works from bash environment. I was trying to make it work from Anaconda Prompt. But later went into my VSCode Terminal's bash environment where it worked just fine.

Upvotes: 0

Sajal Manaktala
Sajal Manaktala

Reputation: 1

For Windows, the following worked for me:

C:\.virtualenvs\env\Scripts>activate.bat

Upvotes: 0

Yemi159
Yemi159

Reputation: 1

env/Scripts/activate worked for me.

Upvotes: 0

Kaïss Bouali
Kaïss Bouali

Reputation: 103

Simple fix:

$ virtualenv env
$ cd env/Scripts/
$ . activate

Upvotes: 2

Archil Labadze
Archil Labadze

Reputation: 4325

On FreeBSD I solved this doing following:

# ls mypienv
# mypienv/bin/activate
mypienv/bin/activate: Permission denied.
# chmod +x mypienv/bin/activate
# mypienv/bin/activate
Missing '}'.

And you see that script not working but:

# ls mypienv/bin/
activate        activate.fish       easy_install-2.7    pip2.7          python2
activate_this.py    activate.ps1        pip         python          python2.7
activate.csh        easy_install        pip2            python-config       wheel

Finaly:

# python mypienv/bin/activate_this.py

And it worked! P.S. I am new with python python verions 2.7

Upvotes: 1

Cyclotron3x3
Cyclotron3x3

Reputation: 2229

In 2.7 version I used this command:

$ cd project_name
$ virtualenv venv --distribute
$ source venv/Scripts/activate
(venv)

Upvotes: 6

Ben
Ben

Reputation: 11481

I would recommend using virtualenvwrapper. It makes working with virtualenv a lot simpler, especially if you have more than one virtualenv.

Upvotes: 1

9000
9000

Reputation: 40904

I usually do it this way:

$ cd the_project_dir
$ . bin/activate
(the_project)$ _

I need to be in the project directory anyway to go on with the work. Obviously the_project_dir is the name of a directory where you have created a virtualenv.

Upvotes: 7

pylonicon
pylonicon

Reputation:

I realize I had to do

jem@jem-laptop:~$ ls
Desktop    examples.desktop  Public           shortener.rb
Documents  Mac4Lin_v1.0      ruby-1.9.1-p378  Templates
Downloads  Music             rubygems-1.3.7   Videos
Dropbox    Pictures          setcolors.vim    virtualenv.py

And here we see virtualenv.py. From here I just had to

jem@jem-laptop:~$ virtualenv ENV
New python executable in ENV/bin/python
Installing setuptools............done.

And then

jem@jem-laptop:~$ source ENV/bin/activate
(ENV)jem@jem-laptop:~$ deactivate
jem@jem-laptop:~$ 

Solved :)

Upvotes: 33

Related Questions