本文介绍了pip install错误:安装脚本指定了绝对路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遭受一种奇怪的点子行为.打电话

I suffer a strange behaviour of pip.Calling

pip install git+https://github.com/username/repo

通常可以使用,但是在某些软件包上,它会以异常方式失败

generally works, but on some packages it fails in an abnormal way

Downloading/unpacking git+git://github.com/artscoop/django-inplaceedit
  Cloning git://github.com/artscoop/django-inplaceedit to /tmp/pip-rl1_7G-build
  Running setup.py egg_info for package from git+git://github.com/artscoop/django-inplaceedit

Installing collected packages: django-inplaceedit
  Running setup.py install for django-inplaceedit

    error: Error: setup script specifies an absolute path:

        /tmp/pip-rl1_7G-build/AUTHORS.rst

    setup() arguments must *always* be /-separated paths relative to the
    setup.py directory, *never* absolute paths.

    Complete output from command /home/steve/virtualenv/project/bin/python -c "import setuptools;__file__='/tmp/pip-rl1_7G-build/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-vVDBRe-record/install-record.txt --single-version-externally-managed --install-headers /home/steve/virtualenv/project/include/site/python2.7:
    running install

running build

running build_py

creating build

creating build/lib.linux-x86_64-2.7

creating build/lib.linux-x86_64-2.7/inplaceeditform

copying inplaceeditform/urls.py -> build/lib.linux-x86_64-2.7/inplaceeditform

copying inplaceeditform/views.py -> build/lib.linux-x86_64-2.7/inplaceeditform

copying inplaceeditform/perms.py -> build/lib.linux-x86_64-2.7/inplaceeditform

copying inplaceeditform/__init__.py -> build/lib.linux-x86_64-2.7/inplaceeditform

copying inplaceeditform/fields.py -> build/lib.linux-x86_64-2.7/inplaceeditform

copying inplaceeditform/adaptors.py -> build/lib.linux-x86_64-2.7/inplaceeditform

copying inplaceeditform/commons.py -> build/lib.linux-x86_64-2.7/inplaceeditform

copying inplaceeditform/tag_utils.py -> build/lib.linux-x86_64-2.7/inplaceeditform

creating build/lib.linux-x86_64-2.7/inplaceeditform/templatetags

copying inplaceeditform/templatetags/__init__.py -> build/lib.linux-x86_64-2.7/inplaceeditform/templatetags

copying inplaceeditform/templatetags/inplace_edit.py -> build/lib.linux-x86_64-2.7/inplaceeditform/templatetags

running egg_info

creating django_inplaceedit.egg-info

writing django_inplaceedit.egg-info/PKG-INFO

writing top-level names to django_inplaceedit.egg-info/top_level.txt

writing dependency_links to django_inplaceedit.egg-info/dependency_links.txt

writing manifest file 'django_inplaceedit.egg-info/SOURCES.txt'

warning: manifest_maker: standard file '-c' not found



reading manifest template 'MANIFEST.in'

writing manifest file 'django_inplaceedit.egg-info/SOURCES.txt'

error: Error: setup script specifies an absolute path:



    /tmp/pip-rl1_7G-build/AUTHORS.rst



setup() arguments must *always* be /-separated paths relative to the

setup.py directory, *never* absolute paths.



----------------------------------------
Command /home/steve/virtualenv/project/bin/python -c "import setuptools;__file__='/tmp/pip-rl1_7G-build/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-vVDBRe-record/install-record.txt --single-version-externally-managed --install-headers /home/steve/virtualenv/project/include/site/python2.7 failed with error code 1 in /tmp/pip-rl1_7G-build
Storing complete log in /home/steve/.pip/pip.log

setuptools-git显然已安装,并且我发现了有关此错误的信息,尽管我被这个问题打了十二遍.我找不到它为什么抱怨拥有绝对路径的原因,因为它是产生绝对路径的那个.

setuptools-git is obviously installed, and I found zero information on this bug, though I've been struck by this a dozen times.I can't find why it complains of having absolute paths since it's the one generating them.

推荐答案

如果在setup.py中存在include_package_data=True,则由项目的egg-info中的SOURCES.txt文件中指定的绝对路径引起.在这种情况下,'django_inplaceedit.egg-info/SOURCES.txt'包含字符串/tmp/pip-rl1_7G-build/AUTHORS.rst,这是无效的绝对路径.在某些情况下,pip和/或setuptools可能会将文件的完整路径从源树放入文件中.我还不能有效地重现此问题,但是我怀疑setup.py中的include_package_data标志会加剧此问题.要解决此问题,只需在egg-info目录中删除该SOURCES.txt文件,然后从源目录再次重新运行setup.py install.

This is caused by an absolute path specified in a SOURCES.txt file within the project's egg-info, if include_package_data=True is present in setup.py. In this case, 'django_inplaceedit.egg-info/SOURCES.txt' contains the string /tmp/pip-rl1_7G-build/AUTHORS.rst, an invalid absolute path. Under some circumstances either pip and/or setuptools may put in the full path of a file from a source tree into it. I have not been able to effectively reproduce this yet, but I suspect the include_package_data flag in setup.py aggravates this issue. To fix, simply just nuke that SOURCES.txt file in the egg-info directory and rerun setup.py install again from the source directory.

这篇关于pip install错误:安装脚本指定了绝对路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-24 11:49