我正在尝试运行一个继承的 Django 项目。我已经设置了一个 virtualenv 并尝试通过pip install -r requirements.txt
. 一切似乎都奏效了。它告诉我它在正确的 virtualenv 中工作,并且包似乎已安装,例如:
Downloading/unpacking django-mediasync==2.2.0 (from -r requirements.txt (line 22))
Downloading django-mediasync-2.2.0.tar.gz
Running setup.py egg_info for package django-mediasync
但是当我尝试同步数据库或运行服务器时,
Unhandled exception in thread started by <bound method Command.inner_run of <django.contrib.staticfiles.management.commands.runserver.Command object at 0x10f15e290>>
Traceback (most recent call last):
File "/Users/me/.virtualenvs/example/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 88, in inner_run
self.validate(display_num_errors=True)
File "/Users/me/.virtualenvs/example/lib/python2.7/site-packages/django/core/management/base.py", line 249, in validate
num_errors = get_validation_errors(s, app)
File "/Users/me/.virtualenvs/example/lib/python2.7/site-packages/django/core/management/validation.py", line 36, in get_validation_errors
for (app_name, error) in get_app_errors().items():
File "/Users/me/.virtualenvs/example/lib/python2.7/site-packages/django/db/models/loading.py", line 146, in get_app_errors
self._populate()
File "/Users/me/.virtualenvs/example/lib/python2.7/site-packages/django/db/models/loading.py", line 61, in _populate
self.load_app(app_name, True)
File "/Users/me/.virtualenvs/example/lib/python2.7/site-packages/django/db/models/loading.py", line 76, in load_app
app_module = import_module(app_name)
File "/Users/me/.virtualenvs/example/lib/python2.7/site-packages/django/utils/importlib.py", line 35, in import_module
__import__(name)
ImportError: No module named mediasync
奇怪的是我mediasync
手动安装(或任何其他必要的包)(pip install django-mediasync
),现在可以找到该包。
我究竟做错了什么?我不想手动安装所有这些软件包。