gpt4 book ai didi

python - Django 依赖项 : hmac?

转载 作者:行者123 更新时间:2023-11-28 22:49:05 27 4
gpt4 key购买 nike

我今天做了很多更改,包括环境变量、Pyscripter 以及将 Python 从 2.7.5 更新到 2.7.7。现在,当我尝试在我的 Django 站点上runserver 时,这些更改之一会引发错误。

(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 并重新安装它,如果这不会弄乱我的项目的话。有任何想法吗?非常感谢!

最佳答案

我在下面的链接中在线找到的一个建议是重置您的 virtualenv,因为升级到 Python 2.7.7 后可能会发生此错误。运行

# virtualenv /path/to/your/virtualenv/

那应该用最新的 python 重置它。

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

对我来说有效的是降级到 python 2.7.6,现在我的 django 1.6.5 应用程序再次运行。

关于python - Django 依赖项 : hmac?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24337416/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com