简体   繁体   English

Virtualenv权限被拒绝

[英]Virtualenv permission denied

After a lot of struggle with virtualenv/virtualenvwrapper I decided to remove all virtualenvs and re-install the packages. 经过与virtualenv / virtualenvwrapper的艰苦奋斗之后,我决定删除所有virtualenvs并重新安装软件包。

root> su myuser
myuser> sudo pip install virtualenv
myuser> sudo pip install virtualenvwrapper

I proceeded to add this to my unix users .bashrc file. 我继续将其添加到我的unix用户.bashrc文件中。

export WORKON_HOME=$HOME/.virtualenvs
export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python2.7
source /usr/local/bin/virtualenvwrapper.sh

When I source .bashrc I get about 20 error lines ending with IOError: [Errno 13] Permission denied: '/root/.virtualenvs/premkproject' . 当我获取.bashrc的源代码时,我得到大约20条以IOError: [Errno 13] Permission denied: '/root/.virtualenvs/premkproject'结尾的错误行IOError: [Errno 13] Permission denied: '/root/.virtualenvs/premkproject' I'm running out of ideas... 我的想法不多了...

I have done my homework and tried every suggested solution I could find. 我已经完成作业,并尝试了所有可以找到的建议解决方案。 I'm running Ubuntu 12.04. 我正在运行Ubuntu 12.04。

I had the same problem and it was due to .virtualenvs having owner and group root. 我有同样的问题,这是由于.virtualenvs具有所有者和组root。 So the following would fix it (substituting ubuntu:ubuntu for your user and groups): 因此,以下将解决此问题(将ubuntu:ubuntu替换为您的用户和组):

cd ~ sudo chown -R ubuntu:ubuntu .virtualenvs/

I used the recursive option as I had a problem installing a package with pip and that was due to a file lower down the hierarchy also having a permissions problem. 我使用递归选项是因为我在使用pip安装软件包时遇到问题,这是由于层次结构中的文件较低,也存在权限问题。

You never explained in which SO are you working...So if you are in Mac OS X you can easily fix it by giving eXecute permissions. 您从未解释过要在哪个SO中工作...因此,如果您使用的是Mac OS X,则可以通过授予eXecute权限轻松修复它。 I believe Linux may face the very same problem altought I myself never got this problem under Linux. 我相信Linux可能会面临同样的问题,而我本人却从未在Linux下遇到此问题。 The 'magic words' are the following : “魔术词”如下:

chmod 755 <your path>/virtualenv.py 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM