如何在没有root用户访问权限的计算机上安装virtualenv [英] How to Install virtualenv on a machine without root access

查看:43
本文介绍了如何在没有root用户访问权限的计算机上安装virtualenv的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在没有root特权的Linux机器上安装virtualenv.我在nettuts( http://net.tutsplus.com/tutorials/python-tutorials/python-power-tools-virtualenv/),并尝试执行以下步骤,但出现以下错误.

I want to install virtualenv on a Linux machine where I don't have root privileges. I saw the screencast at nettuts(http://net.tutsplus.com/tutorials/python-tutorials/python-power-tools-virtualenv/) and tried to follow the steps but getting the following error.

感谢您的帮助.

/home/x01010/python/virtualenv-1.9.1 > which python
/opt/xpyv/bin/python

/home/x01010/python/virtualenv-1.9.1 > python virtualenv.py foo
PYTHONHOME is set. You *must* activate the virtualenv before using it
Traceback (most recent call last):
File "virtualenv.py", line 2577, in <module>
main()
File "virtualenv.py", line 979, in main
no_pip=options.no_pip)
File "virtualenv.py", line 1081, in create_environment
site_packages=site_packages, clear=clear))
File "virtualenv.py", line 1289, in install_python
writefile(site_filename_dst, SITE_PY)
File "virtualenv.py", line 445, in writefile
f = open(dest, 'wb')
IOError: [Errno 2] No such file or directory: 'foo/lib/python26.zip/site.py'</module>

谢谢

推荐答案

创建虚拟环境后,您必须激活它.

You have to activate virtual environment after creating it.

virtualenv --no-site-packages </path/to/new/environment>
source </path/to/new/environment>/bin/activate  

只需在激活虚拟环境后尝试.

Just try after activating virtual environment.

这篇关于如何在没有root用户访问权限的计算机上安装virtualenv的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆