ubuntu 13.04升级后没有模块名称datetime

时间:2013-04-29 01:30:27

标签: django ubuntu python-2.7 virtualenv

刚刚从ubuntu 12.10升级到13.04并在virtualenv中运行django站点时获取此内容

(virtualenv)sysadmin@ubuntu:~/webapps/devsite/djangosite$ ./manage.py runserver
Traceback (most recent call last):
  File "./manage.py", line 2, in <module>
    from django.core.management import execute_manager
  File "/home/sysadmin/webapps/devsite/virtualenv/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 7, in <module>
    from django.core.management.base import BaseCommand, CommandError, handle_default_options
  File "/home/sysadmin/webapps/devsite/virtualenv/local/lib/python2.7/site-packages/django/core/management/base.py", line 14, in <module>
    from django.utils.encoding import smart_str
  File "/home/sysadmin/webapps/devsite/virtualenv/local/lib/python2.7/site-packages/django/utils/encoding.py", line 4, in <module>
    import datetime
ImportError: No module named datetime

1 个答案:

答案 0 :(得分:43)

只做

virtualenv /home/sysadmin/webapps/devsite/virtualenv/

这将在VirtualEnv中重新安装Python,之后它将起作用(并且您不需要重新安装库)。


更新:当我从14.04升级到14.10后处理同样的问题时,virtualenv不想将现有的符号链接覆盖到Python,所以我必须先删除它(在这个例子中是{{1 }})