gpt4 book ai didi

python - 使用全局包的 windows virtualenv

转载 作者:太空宇宙 更新时间:2023-11-04 01:41:30 26 4
gpt4 key购买 nike

我有最新版本的 virtualenv、django-nonrel、djangotoolbox 和 django_mongodb_engine。 virtualenv 是使用 -no-site-packages 创建的。

我试图跟随 quick start但是我在尝试运行 syncdb 时看到以下错误

Traceback (most recent call last):
File "C:\www\environments\mongotest\djangomongo\manage.py", line 11, in <
module>
execute_manager(settings)
File "C:\Python25\lib\site-packages\django-1.2.3-py2.5.egg\django\core\managem
ent\__init__.py", line 438, in execute_manager
utility.execute()
File "C:\Python25\lib\site-packages\django-1.2.3-py2.5.egg\django\core\managem
ent\__init__.py", line 379, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Python25\lib\site-packages\django-1.2.3-py2.5.egg\django\core\managem
ent\__init__.py", line 261, in fetch_command
klass = load_command_class(app_name, subcommand)
File "C:\Python25\lib\site-packages\django-1.2.3-py2.5.egg\django\core\managem
ent\__init__.py", line 67, in load_command_class
module = import_module('%s.management.commands.%s' % (app_name, name))
File "C:\Python25\lib\site-packages\django-1.2.3-py2.5.egg\django\utils\import
lib.py", line 35, in import_module
__import__(name)
File "C:\Python25\lib\site-packages\django-1.2.3-py2.5.egg\django\core\managem
ent\commands\syncdb.py", line 7, in <module>
from django.core.management.sql import custom_sql_for_model, emit_post_sync_
signal
File "C:\Python25\lib\site-packages\django-1.2.3-py2.5.egg\django\core\managem
ent\sql.py", line 5, in <module>
from django.contrib.contenttypes import generic
File "C:\Python25\lib\site-packages\django-1.2.3-py2.5.egg\django\contrib\cont
enttypes\generic.py", line 6, in <module>
from django.db import connection
File "C:\Python25\lib\site-packages\django-1.2.3-py2.5.egg\django\db\__init__.
py", line 77, in <module>
connection = connections[DEFAULT_DB_ALIAS]
File "C:\Python25\lib\site-packages\django-1.2.3-py2.5.egg\django\db\utils.py"
, line 91, in __getitem__
backend = load_backend(db['ENGINE'])
File "C:\Python25\lib\site-packages\django-1.2.3-py2.5.egg\django\db\utils.py"
, line 49, in load_backend
raise ImproperlyConfigured(error_msg)
django.core.exceptions.ImproperlyConfigured: 'django_mongodb_engine' isn't an av
ailable database backend.
Try using django.db.backends.XXX, where XXX is one of:
'dummy', 'mysql', 'oracle', 'postgresql', 'postgresql_psycopg2', 'sqlite3'
Error was: No module named django_mongodb_engine.base

它似乎试图使用默认的 django 安装而不是我的环境 django-nonrel 安装。

我尝试添加 set PYTHONPATH=%PYTHONPATH%;C:\path\to\env\Lib\site-packages\django 但没有改变。

知道为什么这里使用默认的 django 安装吗?

最佳答案

问题出在windows下的文件关联上。我试图通过使用默认 Windows python 安装的“manage.py syncdb”同步数据库。使用“python manage.py syncdb”使用正确的 python 和环境。

关于python - 使用全局包的 windows virtualenv,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4357690/

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