使用Django-Chronograph通过django 1.10中的pip安装失败

时间:2017-04-21 18:14:59

标签: python django pip django-chronograph

this问题相似,但我遇到了不同的错误。

我尝试通过pip安装:

pip install django-chronograph

我使用的是python 2.7和virtualenv

pip freeze
Django==1.10
django-backbone==0.2.3
django-jstemplate==1.1.1
gunicorn==18.0
MySQL-python==1.2.5
six==1.10.0
South==0.7.6
unicodecsv==0.9.4

错误:

pip install django-chronograph
Collecting django-chronograph
  Using cached django-chronograph-0.3.1.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/87/h3ltndc5279cknk_vn9nzjjc0000gn/T/pip-build-_JDRxl/django-chronograph/setup.py", line 32, in <module>
        setup_distribute()
      File "/private/var/folders/87/h3ltndc5279cknk_vn9nzjjc0000gn/T/pip-build-_JDRxl/django-chronograph/setup.py", line 18, in setup_distribute
        distribute_setup = __import__('distribute_setup')
      File "distribute_setup.py", line 1
        <html>
        ^
    SyntaxError: invalid syntax

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/87/h3ltndc5279cknk_vn9nzjjc0000gn/T/pip-build-_JDRxl/django-chronograph/

2 个答案:

答案 0 :(得分:1)

问题在于django-chronograph提供的安装脚本。

setup.py的第16行,它尝试下载脚本: https://bitbucket.org/wnielson/django-chronograph/src/f561106f6aaab62f2817e08e51c799320fd916d9/setup.py?at=default&fileviewer=file-view-default#setup.py-16

在此代码块中:

try:
    import distribute_setup
except:
    # Make sure we have Distribute
    if not os.path.exists('distribute_setup'):
        urllib.urlretrieve('http://nightly.ziade.org/distribute_setup.py',
                           './distribute_setup.py')

但是,当您访问http://nightly.ziade.org/distribute_setup.py处的网址时,会出现404错误,从而导致错误中返回html

您似乎可以在此处分发:https://pypi.python.org/pypi/distribute/0.7.3

或者在安装django-chronograph之前尝试这样做:

pip install distribute
祝你好运!

答案 1 :(得分:0)

django-chronograph未被维护。它的fork性能更好,并且支持Django 2.0和Django 2.1:https://github.com/chrisspen/django-chroniker