本文介绍了如何在 Linux 中激活 virtualenv?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我一直在寻找并尝试了各种替代方案,但都没有成功,现在花了几天时间 - 快把我逼疯了.
I have been searching and tried various alternatives without success and spent several days on it now - driving me mad.
使用 Python 2.5.2 在 Red Hat Linux 上运行开始使用最新的 Virtualenv 但无法激活它,我发现某处建议需要早期版本,所以我使用了 Virtualenv 1.6.4,因为它应该适用于 Python 2.6.
Running on Red Hat Linux with Python 2.5.2Began using most recent Virtualenv but could not activate it, I found somewhere suggesting needed earlier version so I have used Virtualenv 1.6.4 as that should work with Python 2.6.
[necrailk@server6 ~]$ python virtualenv-1.6.4/virtualenv.py virtual
New python executable in virtual/bin/python
Installing setuptools............done.
Installing pip...............done.
环境看起来不错
[necrailk@server6 ~]$ cd virtual
[necrailk@server6 ~/virtual]$ dir
bin include lib
尝试激活
[necrailk@server6 ~/virtual]$ . bin/activate
/bin/.: Permission denied.
检查chmod
[necrailk@server6 ~/virtual]$ cd bin
[necrailk@server6 bin]$ ls -l
total 3160
-rw-r--r-- 1 necrailk biz12 2130 Jan 30 11:38 activate
-rw-r--r-- 1 necrailk biz12 1050 Jan 30 11:38 activate.csh
-rw-r--r-- 1 necrailk biz12 2869 Jan 30 11:38 activate.fish
-rw-r--r-
问题,所以我改了
[necrailk@server6 bin]$ ls -l
total 3160
-rwxr--r-- 1 necrailk biz12 2130 Jan 30 11:38 activate
-rw-r--r-- 1 necrailk biz12 1050 Jan 30 11:38 activate.csh
-rw-r--r-- 1 necrailk biz12 2869 Jan 30 11:38 activate.fish
-rw-r--r-- 1 necrailk biz12 1005 Jan 30 11:38 activate_this.py
-rwxr-xr-x 1 necrailk biz
再次尝试激活
[necrailk@server6 ~/virtual]$ . bin/activate
/bin/.: Permission denied.
仍然没有快乐...
推荐答案
这是我创建文件夹并cd
进入后的工作流程:
Here is my workflow after creating a folder and cd
'ing into it:
$ virtualenv venv --distribute
New python executable in venv/bin/python
Installing distribute.........done.
Installing pip................done.
$ source venv/bin/activate
(venv)$ python
这篇关于如何在 Linux 中激活 virtualenv?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!