In my virtualenv, I need to use sudo for all commands

徘徊边缘 提交于 2019-12-20 20:15:45

问题


I set up a virtualenv, which is working, but for some reason I need to use sudo for commands as simple as mkdir. Obviously I did something incorrectly. Any idea what it might be?

Thanks


回答1:


Check the directory permissions and owner and give:

$ sudo chown -R me:me virtualenvdir
$ sudo chmod -R a+rX virtualenvdir

change me with your username, typically $USER, and virtualenvdir with your virtualenv's work directory.




回答2:


The commands

cd test
sudo virtualenv python

creates a directory called python which is owned by root.

drwxr-xr-x 5 root   root      4096 2010-04-17 11:40 python

That would force you to use sudo for simple things like making a directory inside the python directory.

The fix would be to delete the python directory (saving data first if necessary) and issue the command

virtualenv python

without the sudo.



来源:https://stackoverflow.com/questions/2658902/in-my-virtualenv-i-need-to-use-sudo-for-all-commands

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!