小编Gra*_*yne的帖子

Django测试运行器在Ubuntu上的virtualenv失败

我一直在努力解决在Ubuntu 14.04上安装在Python virtualenv中的Django测试运行器的问题.相同的软件在MacOS上运行正常,我认为在早期版本的Ubuntu上运行良好.

失败消息是:

ImportError: '<test>' module incorrectly imported from '<base-env>/local/lib/python2.7/site-packages/<package-dir>'. Expected '<base-env>/lib/python2.7/site-packages/<package-dir>'. Is this module globally installed?
Run Code Online (Sandbox Code Playgroud)

并且错误的完整堆栈跟踪是:

  Traceback (most recent call last):
    File "/home/annalist/anenv/bin/django-admin", line 11, in <module>
      sys.exit(execute_from_command_line())
    File "/home/annalist/anenv/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 385, in execute_from_command_line
      utility.execute()
    File "/home/annalist/anenv/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 377, in execute
      self.fetch_command(subcommand).run_from_argv(self.argv)
    File "/home/annalist/anenv/local/lib/python2.7/site-packages/django/core/management/commands/test.py", line 50, in run_from_argv
      super(Command, self).run_from_argv(argv)
    File "/home/annalist/anenv/local/lib/python2.7/site-packages/django/core/management/base.py", line 288, in run_from_argv
      self.execute(*args, **options.__dict__)
    File "/home/annalist/anenv/local/lib/python2.7/site-packages/django/core/management/commands/test.py", line 71, in execute
      super(Command, self).execute(*args, **options)
    File "/home/annalist/anenv/local/lib/python2.7/site-packages/django/core/management/base.py", line 338, in execute
      output = self.handle(*args, **options) …
Run Code Online (Sandbox Code Playgroud)

python django ubuntu virtualenv python-unittest

14
推荐指数
2
解决办法
2771
查看次数

标签 统计

django ×1

python ×1

python-unittest ×1

ubuntu ×1

virtualenv ×1