簡體   English   中英

easy_install無法安裝軟件包

[英]easy_install can't install package

我正在嘗試為我的python項目編寫一個setup.py文件:

import os
from setuptools import setup, find_packages
here = os.path.abspath(os.path.dirname(__file__))

requires = [
        'requests',
        'simplejson',
        'logging',
        'rfc3987',
    ]

setup(name='xxxxxxx',
      version='0.1',
      description='xxxxxxx API',
      url='https://github.com/xxxxxxxx',
      packages=find_packages(),
      include_package_data=True,
      zip_safe=False,
      install_requires=requires,
      ) 

當我執行它時,我得到這個錯誤:

Searching for rfc3987
Reading http://pypi.python.org/simple/rfc3987/
Best match: rfc3987 1.3.1
Downloading https://pypi.python.org/packages/source/r/rfc3987/rfc3987-1.3.1.tar.gz#md5=397b1c1cd8b934269e53a621d56d9ed2
Processing rfc3987-1.3.1.tar.gz
Running rfc3987-1.3.1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-AYV_bv/rfc3987-1.3.1/egg-dist-tmp-G8Kbay
Traceback (most recent call last):
  File "/usr/bin/easy_install", line 9, in <module>
    load_entry_point('distribute==0.6.10', 'console_scripts', 'easy_install')()
  File "/usr/lib/python2.6/site-packages/setuptools/command/easy_install.py", line 1715, in main
    with_ei_usage(lambda:
  File "/usr/lib/python2.6/site-packages/setuptools/command/easy_install.py", line 1696, in with_ei_usage
    return f()
  File "/usr/lib/python2.6/site-packages/setuptools/command/easy_install.py", line 1719, in <lambda>
    distclass=DistributionWithoutHelpCommands, **kw
  File "/usr/lib64/python2.6/distutils/core.py", line 152, in setup
    dist.run_commands()
  File "/usr/lib64/python2.6/distutils/dist.py", line 975, in run_commands
    self.run_command(cmd)
  File "/usr/lib64/python2.6/distutils/dist.py", line 995, in run_command
    cmd_obj.run()
  File "/usr/lib/python2.6/site-packages/setuptools/command/easy_install.py", line 236, in run
    self.easy_install(spec, not self.no_deps)
  File "/usr/lib/python2.6/site-packages/setuptools/command/easy_install.py", line 472, in easy_install
    return self.install_item(spec, dist.location, tmpdir, deps)
  File "/usr/lib/python2.6/site-packages/setuptools/command/easy_install.py", line 502, in install_item
    dists = self.install_eggs(spec, download, tmpdir)
  File "/usr/lib/python2.6/site-packages/setuptools/command/easy_install.py", line 681, in install_eggs
    return self.build_and_install(setup_script, setup_base)
  File "/usr/lib/python2.6/site-packages/setuptools/command/easy_install.py", line 958, in build_and_install
    self.run_setup(setup_script, setup_base, args)
  File "/usr/lib/python2.6/site-packages/setuptools/command/easy_install.py", line 947, in run_setup
    run_setup(setup_script, args)
  File "/usr/lib/python2.6/site-packages/setuptools/sandbox.py", line 29, in run_setup
    lambda: execfile(
  File "/usr/lib/python2.6/site-packages/setuptools/sandbox.py", line 70, in run
    return func()
  File "/usr/lib/python2.6/site-packages/setuptools/sandbox.py", line 31, in <lambda>
    {'__file__':setup_script, '__name__':'__main__'}
  File "setup.py", line 4, in <module>

  File "/tmp/easy_install-AYV_bv/rfc3987-1.3.1/rfc3987.py", line 324, in <module>
  File "/tmp/easy_install-AYV_bv/rfc3987-1.3.1/rfc3987.py", line 323, in <genexpr>
  File "/tmp/easy_install-AYV_bv/rfc3987-1.3.1/rfc3987.py", line 319, in _interpret_unicode_escapes
ValueError: zero length field name in format

如果我只嘗試easy_install rfc3987遇到相同的錯誤。

有什么辦法可以解決這個問題?

rfc3987聲稱它可以在Python 2.7和3.x上運行。 您正在嘗試將其安裝在2.6上。 所以失敗了。

該問題與您自己的軟件包或easy_install無關。 如果您手動下載tarball並運行python2.6 setup.py install ,則會遇到相同的錯誤。 實際上,至少在1.3.1中,有類似Python 函數這樣的代碼在Python 2.6下顯然是不合法的。


git歷史記錄來看,似乎已經進行了一些更改使其與Python 2.6兼容,因此下一個發行版可能會起作用。 在此之前,您將無法從2.6開始使用它。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM