2014-01-10 5 views
1

Я пытаюсь установить django-sphinx с помощью pip-3.2, но у меня есть синтаксическая ошибка.поддержка батареи django-sphinx python3

Пожалуйста, скажите, как установить django-sphinx с Python 3.2.

я загрузить сфинкс DEB пакет из из http://sphinxsearch.com/downloads/release/ установки:

dpkg -i sphinxsearch_2.1.4-release-1~wheezy_amd64.deb 

установки журнал:

Do not forget to reindex all indexes by running: indexer --all 

Starting sphinxsearch: Sphinx 2.1.4-id64-release (rel21-r4421) 
Copyright (c) 2001-2013, Andrew Aksyonoff 
Copyright (c) 2008-2013, Sphinx Technologies Inc (http://sphinxsearch.com) 

using config file '/etc/sphinxsearch/sphinx.conf'... 
listening on all interfaces, port=9312 
listening on all interfaces, port=9306 
precaching index 'test1' 
WARNING: index 'test1': preload: failed to open /var/lib/sphinxsearch/data/test1.sph: No such file or directory; NOT SERVING 
precaching index 'test1stemmed' 
WARNING: index 'test1stemmed': preload: failed to open /var/lib/sphinxsearch/data/test1stemmed.sph: No such file or directory; NOT SERVING 
WARNING: multiple addresses found for 'localhost', using the first one (ip=127.0.0.1) 
precaching index 'rt' 
precached 3 indexes in 0.040 sec 
sphinxsearch is started. 

после установки сфинкса я запустить пип-3,2 и попытаться установить Джанго-сфинкс: журнала установку :

Downloading/unpacking django-sphinx 
    Downloading django-sphinx-2.2.4.tar.gz 
    Running setup.py egg_info for package django-sphinx 

    warning: no previously-included files matching '*~' found anywhere in distri 
bution 
Requirement already satisfied (use --upgrade to upgrade): django in /usr/local/l 
ib/python3.2/dist-packages (from django-sphinx) 
Installing collected packages: django-sphinx 
    Running setup.py install for django-sphinx 

    warning: no previously-included files matching '*~' found anywhere in distri 
bution 
     File "/usr/local/lib/python3.2/dist-packages/djangosphinx/config.py", line 
56 
     print render_to_string(getattr(settings, 'SPHINX_CONFIG_TEMPLATE', 'conf 
/sphinx.conf'), context) 
          ^
    SyntaxError: invalid syntax 

     File "/usr/local/lib/python3.2/dist-packages/djangosphinx/apis/current.py" 
, line 5 
     except ImportError, exc: 
         ^
    SyntaxError: invalid syntax 

     File "/usr/local/lib/python3.2/dist-packages/djangosphinx/apis/api278/__in 
it__.py", line 78 
     SPH_ATTR_MULTI     = 0X40000000L 
                ^
    SyntaxError: invalid syntax 

     File "/usr/local/lib/python3.2/dist-packages/djangosphinx/apis/api275/__in 
it__.py", line 75 
     SPH_ATTR_MULTI     = 0X40000000L 
                ^
    SyntaxError: invalid syntax 

     File "/usr/local/lib/python3.2/dist-packages/djangosphinx/apis/api263/__in 
it__.py", line 119 
     except socket.error, msg: 
         ^
    SyntaxError: invalid syntax 

     File "/usr/local/lib/python3.2/dist-packages/djangosphinx/utils/config.py" 
, line 18 
     raise ValueError, "Only MySQL and PostgreSQL engines are supported by Sp 
hinx." 
         ^
    SyntaxError: invalid syntax 

     File "/usr/local/lib/python3.2/dist-packages/djangosphinx/models.py", line 
450 
     raise NotImplementedError, 'Related object and/or multiple field lookups 
not supported' 
           ^
    SyntaxError: invalid syntax 

     File "/usr/local/lib/python3.2/dist-packages/djangosphinx/management/comma 
nds/generate_sphinx_config.py", line 19 
     print generate_config_for_model(model, index) 
            ^
    SyntaxError: invalid syntax 

Successfully installed django-sphinx 
Cleaning up... 

май быть моей проблемой: django -sphinx не поддерживает python3.X? https://www.djangopackages.com/grids/g/search/

+1

Добавление ошибки может помочь. – Paolo

+0

http://pastebin.com/FXuqj9G7 установить журнал – ijj

ответ

0

Одна из причин, вы получаете синтаксические ошибки в том, что try/except синтаксис изменен с Python 2 на Python 3.

В Python 3 следует использовать

except ImportError as exc: 

вместо

except ImportError, exc: 

Речь идет не только о синтаксисе импорта, считывая сообщения об ошибках, которые мы видим t вот и другие проблемы из-за несовместимости между двумя версиями. Я думаю, Джанго-сфинкс не был обновлен для работы с Python 3.

Ссылки: http://docs.python.org/3/whatsnew/3.0.html

Смежные вопросы