Python django virtualenv-错误:没有名为south的模块

Python django virtualenv-错误:没有名为south的模块,python,django,virtualenv,django-south,Python,Django,Virtualenv,Django South,当我尝试以下操作时,会出现此错误: source./env/bin/activate sudo python manage.py syncdb Syncing... Traceback (most recent call last): File "manage.py", line 10, in <module> execute_from_command_line(sys.argv) File "/home/andrius/env/loca

当我尝试以下操作时,会出现此错误:

source./env/bin/activate

sudo python manage.py syncdb

Syncing...
Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/home/andrius/env/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 443, in execute_from_command_line
    utility.execute()
  File "/home/andrius/env/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 382, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/andrius/env/local/lib/python2.7/site-packages/django/core/management/base.py", line 196, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/home/andrius/env/local/lib/python2.7/site-packages/django/core/management/base.py", line 232, in execute
    output = self.handle(*args, **options)
  File "/home/andrius/env/local/lib/python2.7/site-packages/django/core/management/base.py", line 371, in handle
    return self.handle_noargs(**options)
  File "/home/andrius/env/local/lib/python2.7/site-packages/south/management/commands/syncdb.py", line 90, in handle_noargs
    syncdb.Command().execute(**options)
  File "/home/andrius/env/local/lib/python2.7/site-packages/django/core/management/base.py", line 232, in execute
    output = self.handle(*args, **options)
  File "/home/andrius/env/local/lib/python2.7/site-packages/django/core/management/base.py", line 371, in handle
    return self.handle_noargs(**options)
  File "/home/andrius/env/local/lib/python2.7/site-packages/django/core/management/commands/syncdb.py", line 57, in handle_noargs
    cursor = connection.cursor()
  File "/home/andrius/env/local/lib/python2.7/site-packages/django/db/backends/__init__.py", line 306, in cursor
    cursor = self.make_debug_cursor(self._cursor())
  File "/home/andrius/env/local/lib/python2.7/site-packages/django/db/backends/postgresql_psycopg2/base.py", line 177, in _cursor
    self.connection = Database.connect(**conn_params)
  File "/home/andrius/env/local/lib/python2.7/site-packages/psycopg2-2.4.6-py2.7-linux-x86_64.egg/psycopg2/__init__.py", line 178, in connect
    return _connect(dsn, connection_factory=connection_factory, async=async)
psycopg2.OperationalError: FATAL:  Peer authentication failed for user "django"
错误:没有名为south的模块

我在激活virtualenv后安装了south,使用pip安装south(以及django)

在settings.py中安装的应用程序:

INSTALLED_APPS = (
    'south',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.messages',
    'django.contrib.staticfiles',
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql_psycopg2', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
        'NAME': 'finance',                      # Or path to database file if using sqlite3.
        'USER': 'django',                      # Not used with sqlite3.
        'PASSWORD': 'mydb123',                  # Not used with sqlite3.
        'HOST': '',                      # Set to empty string for localhost. Not used with sqlite3.
        'PORT': '',                      # Set to empty string for default. Not used with sqlite3.
    }
有什么问题吗

更新: 我在尝试不使用sudo进行同步时遇到此错误。可能与“南方”问题有关:

(环境)andrius@ubuntu:~/djcode/myproject$python manage.py syncdb

Syncing...
Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/home/andrius/env/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 443, in execute_from_command_line
    utility.execute()
  File "/home/andrius/env/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 382, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/andrius/env/local/lib/python2.7/site-packages/django/core/management/base.py", line 196, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/home/andrius/env/local/lib/python2.7/site-packages/django/core/management/base.py", line 232, in execute
    output = self.handle(*args, **options)
  File "/home/andrius/env/local/lib/python2.7/site-packages/django/core/management/base.py", line 371, in handle
    return self.handle_noargs(**options)
  File "/home/andrius/env/local/lib/python2.7/site-packages/south/management/commands/syncdb.py", line 90, in handle_noargs
    syncdb.Command().execute(**options)
  File "/home/andrius/env/local/lib/python2.7/site-packages/django/core/management/base.py", line 232, in execute
    output = self.handle(*args, **options)
  File "/home/andrius/env/local/lib/python2.7/site-packages/django/core/management/base.py", line 371, in handle
    return self.handle_noargs(**options)
  File "/home/andrius/env/local/lib/python2.7/site-packages/django/core/management/commands/syncdb.py", line 57, in handle_noargs
    cursor = connection.cursor()
  File "/home/andrius/env/local/lib/python2.7/site-packages/django/db/backends/__init__.py", line 306, in cursor
    cursor = self.make_debug_cursor(self._cursor())
  File "/home/andrius/env/local/lib/python2.7/site-packages/django/db/backends/postgresql_psycopg2/base.py", line 177, in _cursor
    self.connection = Database.connect(**conn_params)
  File "/home/andrius/env/local/lib/python2.7/site-packages/psycopg2-2.4.6-py2.7-linux-x86_64.egg/psycopg2/__init__.py", line 178, in connect
    return _connect(dsn, connection_factory=connection_factory, async=async)
psycopg2.OperationalError: FATAL:  Peer authentication failed for user "django"
settings.py中的我的数据库设置:

INSTALLED_APPS = (
    'south',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.messages',
    'django.contrib.staticfiles',
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql_psycopg2', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
        'NAME': 'finance',                      # Or path to database file if using sqlite3.
        'USER': 'django',                      # Not used with sqlite3.
        'PASSWORD': 'mydb123',                  # Not used with sqlite3.
        'HOST': '',                      # Set to empty string for localhost. Not used with sqlite3.
        'PORT': '',                      # Set to empty string for default. Not used with sqlite3.
    }

}

在安装south或运行syncdb时,不要成为sudoer。照办

pip install south python manage.py syncdb pip安装南部 python manage.py syncdb
只需从已安装的应用程序中删除south

Django 1.7及以上不需要南部


要删除south,请使用pip uninstall south然后使用y完全删除它

尝试将south放在已安装应用程序的末尾:现在您已经在系统范围内安装了south,您需要配置Django以使用它。这样做很简单;只需编辑settings.py并在已安装的应用程序末尾添加“south”。()激活你的VirtualNV,启动python,然后从交互式shell中尝试“导入南方”。它有效吗?实际上我把它放在安装的应用程序的末尾。但它给出了相同的错误。我认为使用south path应该没问题,因为django和south在同一个目录中,django应用程序没有给出这个错误。@DanielEriksson是的,在interactive shell中它起作用了。所以我不明白为什么在interactive shell中看到south模块时会出现这个错误……通常我不使用sudo,但我认为它需要sudo,由于身份验证错误。我的坏:)对我来说,
south
不在已安装的应用程序中,但我仍然收到此错误。和
pip卸载south
报告:
south未安装