2017-04-21 24 views
1

類似於this問題,但我得到了一個不同的錯誤。用Django計時器安裝失敗在Django 1.10

我嘗試通過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/ 

回答

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的計時碼錶前:

pip install distribute 

祝你好運!

+0

它的作品像一個魅力,謝謝。 –