问题
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?
回答1:
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 :)
回答2:
In 2.7 version I used this command:
$ cd project_name
$ virtualenv venv --distribute
$ source venv/Scripts/activate
(venv)
回答3:
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.
回答4:
I would recommend using virtualenvwrapper. It makes working with virtualenv a lot simpler, especially if you have more than one virtualenv.
回答5:
Simple fix:
$ virtualenv env
$ cd env/Scripts/
$ . activate
回答6:
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
来源:https://stackoverflow.com/questions/3843981/how-come-i-can-not-activate-my-virtual-python-environment-with-source-env-bin-a