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 上运行 Lubuntu 12.10 和 Mountain Lion,并设置了一个分区用作两个安装之间的共享主目录,大致遵循此处的说明(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屋!