virtualenv python可执行文件的奇怪权限问题(lubuntu-12.10) [英] strange permissions problems for virtualenv python executable (lubuntu-12.10)
问题描述
简而言之,我的问题是,当我尝试使用virtualenvwrapper中的mkvirtualenv创建virtualenv时,出现以下错误:
In brief, my problem is that when I try to create a virtualenv using mkvirtualenv from virtualenvwrapper, I get the following error:
$ mkvirtualenv test
New python executable in test/bin/python
ERROR: The executable test/bin/python could not be run: [Errno 13] Permission denied
但是,据我所知,当我查看二进制文件的权限时,一切都应该很好...
However, when I look at the permissions for the binary, as far as I can tell, everything should be fine...
$ ll ~/.virtualenvs/test/bin
total 2604
drwxr-xr-x 1 (username) staff 5 Feb 7 19:10 ./
drwxr-xr-x 1 (username) staff 5 Feb 7 18:51 ../
-rwxr-xr-x 1 (username) staff 2655776 Feb 7 19:10 python*
lrwxrwxrwx 1 (username) staff 6 Feb 7 19:10 python2 -> python*
lrwxrwxrwx 1 (username) staff 6 Feb 7 19:10 python2.7 -> python*
当我尝试以root身份运行时,也会遇到类似的错误:
I get similar errors when I try to run as root:
$ sudo .virtualenvs/test/bin/python
sudo: unable to execute .virtualenvs/test/bin/python: Permission denied
我正在Macbook上与Mountain Lion一起运行Lubuntu 12.10,并大致按照此处的说明设置了一个分区,以用作两次安装之间的共享主目录. mikeclaffey.com/dual-boot-osx-ubuntu/">http://mikeclaffey.com/dual-boot-osx-ubuntu/).据我所知,在ubuntu和山狮中,这一切都可以正常工作,但是我之所以提及它只是因为这意味着我的lubuntu安装并非严格标准.
I'm running Lubuntu 12.10 on my macbook, alongside Mountain Lion, and have set up a partition to use as a shared home directory between the two installs, roughly following the instructions here (http://mikeclaffey.com/dual-boot-osx-ubuntu/). As far as I can tell, this is all working correctly, both in ubuntu and mountain lion, but I mention it just because it means my lubuntu installation isn't strictly standard.
我已经使用apt-get安装了python-setuptools和python-dev,然后使用sudo easy_install pip
来获取pip-1.2.1,然后使用sudo pip install virtualenv virtualenvwrapper
来获取virtualenv-1.8.4和virtualenvwrapper-3.6.
I've installed python-setuptools and python-dev using apt-get, then used sudo easy_install pip
to get pip-1.2.1, followed by sudo pip install virtualenv virtualenvwrapper
, to get virtualenv-1.8.4 and virtualenvwrapper-3.6.
更多细节:我已经在主目录中创建了.virtualenvs
,并添加了:
Further particulars: I've created .virtualenvs
in my home directory, and added:
export WORKON_HOME=$HOME/.virtualenvs
source /usr/local/bin/virtualenvwrapper.sh
export PIP_VIRTUALENV_BASE=$WORKON_HOME
到我的.bashrc
.
此外,我尝试使用sudo apt-get install python-pip
而不是easy_install(这将安装pip-1.1,而不是pip-1.2.1),但是会出现相同的权限错误.
Also, I have tried using sudo apt-get install python-pip
instead of easy_install (this installs pip-1.1, rather than pip-1.2.1), but get the same permission errors.
任何帮助将不胜感激!
推荐答案
事实证明,问题出在我如何挂载共享分区.我已经安装了(在/etc/fstab中):
It turns out the problem was to do with how I'd mounted my shared partition. I'd mounted with (in /etc/fstab):
UUID=.... /home hfsplus auto,user,nodev,rw 0 0
但是,'user'选项自动包含'noexec'---因此,在virtualenv将系统python二进制文件复制到我的主分区之后,由于'noexec'标志,它无法运行.
However, the 'user' option automatically includes 'noexec' --- thus, after virtualenv had copied the system python binary to my home partition, it was unable to run because of the 'noexec' flag.
将我的fstab更改为:
Changing my fstab to read:
UUID=.... /home hfsplus auto,user,exec,nodev,rw 0 0
解决了问题.
这篇关于virtualenv python可执行文件的奇怪权限问题(lubuntu-12.10)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!