gpt4 book ai didi

python - 在 Django 产品中从 Python 2.6 升级到 Python 2.7

转载 作者:可可西里 更新时间:2023-11-01 11:53:22 26 4
gpt4 key购买 nike

Django 版本 1.5.2操作系统 : Windows

我正在尝试将用于 Django 项目的 python 从 2.6 升级到 2.7。我对以下文件做了相应的修改

  1. 正确设置路径以指向新的 python 2.7
  2. 第三方包已正确更新/重新安装 python 2.7
  3. 更改 *.wsgi 文件以包含新安装的第三方包
  4. http.conf 已更改为 WSGIScriptAlias 的 Directory 标签

但是当我尝试通过浏览器连接服务器时,出现以下异常

Sun May 18 20:55:41 2014] [error] [client 127.0.0.1] mod_wsgi (pid=6184): Exception occurred processing WSGI script 'E:/Build/ACS/umonitor/ngnms/apache_django.wsgi'.
[Sun May 18 20:55:41 2014] [error] [client 127.0.0.1] Traceback (most recent call last):
[Sun May 18 20:55:41 2014] [error] [client 127.0.0.1] File "E:/Build/ACS/umonitor/ngnms/apache_django.wsgi", line 1, in <module>
[Sun May 18 20:55:41 2014] [error] [client 127.0.0.1] import os, sys
[Sun May 18 20:55:41 2014] [error] [client 127.0.0.1] File "E:\\Build\\ACS\\umonitor\\bin\\.\\\\..\\python\\Lib\\os.py", line 398, in <module>
[Sun May 18 20:55:41 2014] [error] [client 127.0.0.1] import UserDict
[Sun May 18 20:55:41 2014] [error] [client 127.0.0.1] File "E:\\Build\\ACS\\umonitor\\bin\\.\\\\..\\python\\Lib\\UserDict.py", line 84, in <module>
[Sun May 18 20:55:41 2014] [error] [client 127.0.0.1] _abcoll.MutableMapping.register(IterableUserDict)
[Sun May 18 20:55:41 2014] [error] [client 127.0.0.1] File "E:\\Build\\ACS\\umonitor\\bin\\.\\\\..\\python\\Lib\\abc.py", line 109, in register
[Sun May 18 20:55:41 2014] [error] [client 127.0.0.1] if issubclass(subclass, cls):
[Sun May 18 20:55:41 2014] [error] [client 127.0.0.1] File "E:\\Build\\ACS\\umonitor\\bin\\.\\\\..\\python\\Lib\\abc.py", line 184, in __subclasscheck__
[Sun May 18 20:55:41 2014] [error] [client 127.0.0.1] cls._abc_negative_cache.add(subclass)
[Sun May 18 20:55:41 2014] [error] [client 127.0.0.1] File "E:\\Build\\ACS\\umonitor\\bin\\.\\\\..\\python\\Lib\\_weakrefset.py", line 84, in add
[Sun May 18 20:55:41 2014] [error] [client 127.0.0.1] self.data.add(ref(item, self._remove))
[Sun May 18 20:55:41 2014] [error] [client 127.0.0.1] TypeError: cannot create weak reference to 'classobj' object
[Sun May 18 20:55:41 2014] [error] [client 127.0.0.1] mod_wsgi (pid=6184): Target WSGI script 'E:/Build/ACS/umonitor/ngnms/apache_django.wsgi' cannot be loaded as Python module.
[Sun May 18 20:55:41 2014] [error] [client 127.0.0.1] mod_wsgi (pid=6184): Exception occurred processing WSGI script 'E:/Build/ACS/umonitor/ngnms/apache_django.wsgi'.
[Sun May 18 20:55:41 2014] [error] [client 127.0.0.1] Traceback (most recent call last):
[Sun May 18 20:55:41 2014] [error] [client 127.0.0.1] File "E:/Build/ACS/umonitor/ngnms/apache_django.wsgi", line 1, in <module>
[Sun May 18 20:55:41 2014] [error] [client 127.0.0.1] import os, sys
[Sun May 18 20:55:41 2014] [error] [client 127.0.0.1] File "E:\\Build\\ACS\\umonitor\\bin\\.\\\\..\\python\\Lib\\os.py", line 398, in <module>
[Sun May 18 20:55:41 2014] [error] [client 127.0.0.1] import UserDict
[Sun May 18 20:55:41 2014] [error] [client 127.0.0.1] File "E:\\Build\\ACS\\umonitor\\bin\\.\\\\..\\python\\Lib\\UserDict.py", line 84, in <module>
[Sun May 18 20:55:41 2014] [error] [client 127.0.0.1] _abcoll.MutableMapping.register(IterableUserDict)
[Sun May 18 20:55:41 2014] [error] [client 127.0.0.1] File "E:\\Build\\ACS\\umonitor\\bin\\.\\\\..\\python\\Lib\\abc.py", line 109, in register
[Sun May 18 20:55:41 2014] [error] [client 127.0.0.1] if issubclass(subclass, cls):
[Sun May 18 20:55:41 2014] [error] [client 127.0.0.1] File "E:\\Build\\ACS\\umonitor\\bin\\.\\\\..\\python\\Lib\\abc.py", line 184, in __subclasscheck__
[Sun May 18 20:55:41 2014] [error] [client 127.0.0.1] cls._abc_negative_cache.add(subclass)
[Sun May 18 20:55:41 2014] [error] [client 127.0.0.1] File "E:\\Build\\ACS\\umonitor\\bin\\.\\\\..\\python\\Lib\\_weakrefset.py", line 84, in add
[Sun May 18 20:55:41 2014] [error] [client 127.0.0.1] self.data.add(ref(item, self._remove))
[Sun May 18 20:55:41 2014] [error] [client 127.0.0.1] TypeError: cannot create weak reference to 'classobj' object

最佳答案

您需要一个为 Python 2.7 编译的新版本的 mod_wsgi。

关于python - 在 Django 产品中从 Python 2.6 升级到 Python 2.7,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23730548/

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