python setup.py sdist错误:不允许操作
我正在尝试创建一个python源包,但在为文件创建硬链接时失败。
$ python setup.py sdist
running sdist
running check
reading manifest template 'MANIFEST.in'
writing manifest file 'MANIFEST'
making hard links in foo-0.1...
hard linking README.txt -> foo-0.1
error: Operation not permitted
我尝试使用 sudo 运行该命令,但它会产生相同的错误。
这也会产生相同的错误:
ln foo bar
我正在使用 vbox 运行 ubuntu 的虚拟实例,这可能就是问题的根源。创建源代码发行版时有没有办法使用硬链接?
系统信息:
Ubuntu服务器11.04; 虚拟盒 4.14; 操作系统 10.6.6; 蟒蛇2.7.1;
I'm trying to create a python source package, but it fails when creating hard links for files.
$ python setup.py sdist
running sdist
running check
reading manifest template 'MANIFEST.in'
writing manifest file 'MANIFEST'
making hard links in foo-0.1...
hard linking README.txt -> foo-0.1
error: Operation not permitted
I've tried running the command with sudo, but it produces the same error.
This also produces the same error:
ln foo bar
I'm using vbox to run a virtual instance of ubuntu, which is probably where the problem comes from. Is there a way round using hard links when creating source distributions?
System information:
Ubuntu server 11.04;
VirtualBox 4.14;
osx 10.6.6;
python 2.7.1;
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
同样的问题。我使用的是 vagrant,我的主机操作系统是 Windows,而 Gust 操作系统是 Ubuntu。我不是 vim 粉丝,所以 @simo 的回答对我没有多大帮助,因为我确实依赖虚拟盒共享文件夹将 sublime 编辑器所做的更改同步到 Ubuntu 虚拟机。
感谢 Fabian Kochem,他找到了一个快速但肮脏的解决方法:post
Same issue. I am using vagrant, my host OS is Windows while the Gust OS is Ubuntu. I am not a vim fan, so @simo's answer does not help me much because I really rely on virtual box shared folders to sync changes made by sublime editor to the Ubuntu virtual machine.
Thanks to Fabian Kochem, he found a quick and dirty workaround: post
我遇到了同样的问题。
我可以通过将 python 源代码从 virtual box 共享文件夹移动到我的 debian 主文件夹来使其工作。 sdist 上不再有错误。
我希望它有帮助。
I ran into the same issues.
I was able to get it working by moving the python sources from the virtual box shared folder to my debian home folder. No error on sdist anymore.
I hope it helps.
从您的问题中不清楚哪一步失败了。可能是错误之前的硬链接。您可以尝试 strace 来查看哪个系统调用失败。这至少应该可以更好地描述问题。
这个 python 错误报告 看起来他们不会在 distutils2 之前修复这个问题。有人确实提供了可能对您有用的补丁。您也许还可以通过 NFS 挂载目录并在其中构建。我相信 NFS 允许硬链接。
It is unclear from your question what step is failing. Might be the hard linking right before the error. You can try strace to see what system call is failing. That should give a better picture of the problem at least.
This python bug report looks like they're not going to fix this until distutils2. Someone did supply a patch that might be useful to you. You might also be able to mount a directory over NFS and build there. I believe that NFS allows hard linking.
看起来这个问题已在 Python 版本 2.7.9 中修复 - https://hg.python。 org/cpython/raw-file/v2.7.9/Misc/NEWS
问题 #8876:distutils 现在在硬链接时回退到复制文件
不起作用。这允许与特殊文件系统(例如 VirtualBox)一起使用
共享文件夹
Looks like this was fixed in Python version 2.7.9 - https://hg.python.org/cpython/raw-file/v2.7.9/Misc/NEWS
Issue #8876: distutils now falls back to copying files when hard linking
doesn't work. This allows use with special filesystems such as VirtualBox
shared folders
这是我使用 Python-2.7.10 实现工作 uwsgi(Ubuntu 14.04,默认 Python 2.7.6)的方法。
步骤
在继续之前,您必须使用
--enable-shared
编译新的 Python:上下文:Ubuntu 14.04 和 Python 2.7.6,使用 apt 安装了 uwsgi 和 uwsgi-python-plugin -得到
问题:我有一个 virtualenv,用于编译 Python-2.7.10
准备东西:
在 ini 文件上:
结果:
This is the way I reached a working uwsgi(Ubuntu 14.04, default Python 2.7.6) with Python-2.7.10.
Steps
Before continuing, you must compile new Python with
--enable-shared
:Context: Ubuntu 14.04 with Python 2.7.6 with uwsgi and uwsgi-python-plugin installed with apt-get
Problem: I have a virtualenv for my all with compiled Python-2.7.10
Preparing stuff:
On ini file:
Results on:
以上答案都没有解决我的问题。但是,我在 Centos 6 上的 vagrant 共享文件夹中运行以下命令:
并最终出现错误:
事实证明,这是一个最终执行硬链接的 bash 文件:
因此您应该能够替换硬链接
ln - f "$pyc" "$pyo"
在上面的 shell 脚本中使用复制命令 cp "$pyc" "$pyo" 。None of the above answers solved my problem. However, I was running the following command in a vagrant shared folder on Centos 6:
And ended up with the error:
It turns out that it's a bash file that eventually executes the hard links:
Therefore you should be able to replace the hard link
ln -f "$pyc" "$pyo"
with a copy commandcp "$pyc" "$pyo"
in the above shell script.