2014-06-21 64 views
2

我今天做了很多改變,包括環境變量,Pyscripter和從2.7.5更新Python到2.7.7。當我嘗試在我的Django站點上嘗試runserver時,其中一個更改現在會導致出現錯誤。Django依賴:hmac?

(myEnv)PS C:\Users\Josh\.virtualenvs\myEnv\tumblr> python manage.py runserver 
Traceback (most recent call last): 
    File "manage.py", line 10, in <module> 
    execute_from_command_line(sys.argv) 
    File "C:\Python27\Lib\site-packages\django\core\management\__init__.py", line 399, in execute_from_command_line 
    utility.execute() 
    File "C:\Python27\Lib\site-packages\django\core\management\__init__.py", line 392, in execute 
    self.fetch_command(subcommand).run_from_argv(self.argv) 
    File "C:\Python27\Lib\site-packages\django\core\management\__init__.py", line 261, in fetch_command 
    commands = get_commands() 
    File "C:\Python27\Lib\site-packages\django\core\management\__init__.py", line 107, in get_commands 
    apps = settings.INSTALLED_APPS 
    File "C:\Python27\Lib\site-packages\django\conf\__init__.py", line 54, in __getattr__ 
    self._setup(name) 
    File "C:\Python27\Lib\site-packages\django\conf\__init__.py", line 50, in _setup 
    self._configure_logging() 
    File "C:\Python27\Lib\site-packages\django\conf\__init__.py", line 72, in _configure_logging 
    from django.utils.log import DEFAULT_LOGGING 
    File "C:\Python27\Lib\site-packages\django\utils\log.py", line 7, in <module> 
    from django.views.debug import ExceptionReporter, get_exception_reporter_filter 
    File "C:\Python27\Lib\site-packages\django\views\debug.py", line 10, in <module> 
    from django.http import (HttpResponse, HttpResponseServerError, 
    File "C:\Python27\Lib\site-packages\django\http\__init__.py", line 2, in <module> 
    from django.http.request import (HttpRequest, QueryDict, UnreadablePostError, 
    File "C:\Python27\Lib\site-packages\django\http\request.py", line 11, in <module> 
    from django.core import signing 
    File "C:\Python27\Lib\site-packages\django\core\signing.py", line 45, in <module> 
    from django.utils.crypto import constant_time_compare, salted_hmac 
    File "C:\Python27\Lib\site-packages\django\utils\crypto.py", line 6, in <module> 
    import hmac 
    File "C:\Python27\Lib\hmac.py", line 8, in <module> 
    from operator import _compare_digest as compare_digest 
ImportError: cannot import name _compare_digest 

我試過更新Django,但我有最新版本。接下來是卸載Django並重新安裝它,如果這不會搞亂我的項目。有任何想法嗎?非常感謝!

回答

4

我在下面的鏈接中發現的一個建議是重置您的virtualenv,因爲升級到Python 2.7.7後可能會發生此錯誤。運行

# virtualenv /path/to/your/virtualenv/ 

,並應與最新的Python重置。

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=749491

對我工作是向下降級到2.7.6蟒蛇,現在我的Django 1.6.5應用程序重新工作。