VirtualEnv 无法导入 wraps 名称

0 投票
1 回答
1384 浏览
提问于 2025-04-16 07:44

我正在想办法弄清楚为什么我的Django wsgi脚本无法运行。在正常的Python环境下它运行得很好,但在虚拟环境(virtualenv)中却出现了以下错误信息:

(virtualenv)... [~]# python djangosites/test1.wsgi
Traceback (most recent call last):
  File "djangosites/test1.wsgi", line 13, in <module>
    from django.core.handlers.wsgi import WSGIHandler
  File "/home/myofirst/virtualenv/lib/python2.6/site-packages/Django-1.2.3-py2.6.egg/django/core/handlers/wsgi.py", line 1, in <module>
    from threading import Lock
  File "/opt/python2.6/lib/python2.6/threading.py", line 13, in <module>
    from functools import wraps
ImportError: cannot import name wraps

看起来我需要安装functools这个库。我尝试通过easy_install来安装,但现在无论是pip还是easy_install都无法运行,它们都抱怨缺少wraps。我需要安装或卸载什么才能解决这个问题呢?

1 个回答

1

我创建了一个新的虚拟环境,因为之前的那个坏掉了。现在没有问题了。

撰写回答