为什么我无法用'source env/bin/activate'命令激活虚拟Python环境?
我正在尝试激活我的虚拟Python环境,以便与Pylons一起使用,但我觉得我执行命令的方式不对。
jem@jem-laptop:~$ source env/bin/activate
bash: env/bin/activate: No such file or directory
我哪里做错了?我应该怎么做才对呢?
8 个回答
6
在2.7版本中,我使用了这个命令:
$ cd project_name
$ virtualenv venv --distribute
$ source venv/Scripts/activate
(venv)
7
我通常是这样做的:
$ cd the_project_dir
$ . bin/activate
(the_project)$ _
反正我需要在项目的文件夹里才能继续工作。显然,the_project_dir
是你创建虚拟环境的那个文件夹的名字。
32
我意识到我需要做的是
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
在这里我们看到了virtualenv.py。接下来我只需要
jem@jem-laptop:~$ virtualenv ENV
New python executable in ENV/bin/python
Installing setuptools............done.
然后
jem@jem-laptop:~$ source ENV/bin/activate
(ENV)jem@jem-laptop:~$ deactivate
jem@jem-laptop:~$
问题解决了 :)