简体   繁体   English

Django-安装Django时权限被拒绝

[英]Django - Permission denied when installing django

It seems I dont have some permissions to write files on my server which is strange because I'm a user with all the privileges as the "root" has. 看来我没有在我的服务器上写文件的权限,这很奇怪,因为我是具有“ root”权限的所有用户。

I was editing my /etc/ssh/sshd_config file, adding my user in AllowUsers : 我正在编辑我的/etc/ssh/sshd_config文件,将我的用户添加到AllowUsers

AllowUsers myuser

Then I've added the privileges on visudo 然后我在visudo上添加了特权

# User privilege specification
root    ALL=(ALL:ALL) ALL
myuser ALL=(ALL:ALL) ALL

So, What I'm trying to do is install Django using virtualenv but I'm getting this error: 所以,我想做的是使用virtualenv安装Django,但出现此错误:

OSError: [Errno 13] Permission denied: '/opt/www/some/myvenv/build'    

after: 后:

$ source myvenv/bin/activate
$ pip install Django==1.6.5

FYI: I'm installing this stuffs in /opt/www/ 仅供参考:我正在/ opt / www /中安装这些东西

Any idea to solve this? 有解决的办法吗?

Even though you're in the sudoers file, that doesn't give you any more permissions than a regular user. 即使您在sudoers文件中,也不会给您比普通用户更多的权限。 You'll have to run the pip install with the sudo command to run it with admin privileges: 您必须使用sudo命令运行pip install才能以管理员权限运行它:

sudo pip install Django==1.6.5

Of course, you have to be careful when running things with sudo, you might damage stuff etc. etc., so make sure you know what you are doing ;) 当然,使用sudo运行内容时必须小心,可能会损坏东西等,因此请确保您知道自己在做什么;)

if you are using Ubuntu then use command 如果您使用的是Ubuntu,则使用命令

sudo pip install Django==1.6.5

it will install Django of version 1.6.5 它将安装版本1.6.5的Django

OR 要么

try to give 777 permission on the folder. 尝试给该文件夹777权限。 refer the link : https://docs.djangoproject.com/en/dev/topics/install/ 请参阅链接: https : //docs.djangoproject.com/en/dev/topics/install/

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

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