加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > Python > 正文

django – ImportError:没有名为south的模块

发布时间:2020-12-20 13:36:16 所属栏目:Python 来源:网络整理
导读:运行syncdb时遇到错误`ImportError:没有名为south的模块.有什么建议? Django 1.5.1和 Python 2.7.5 我认为South已经安装,因为我刚刚运行easy_install并且得到了 [ckoziak@web415 mvp_landing]$easy_install southSearching for southBest match: South 0.8
运行syncdb时遇到错误`ImportError:没有名为south的模块.有什么建议? Django 1.5.1和 Python 2.7.5

我认为South已经安装,因为我刚刚运行easy_install并且得到了

[ckoziak@web415 mvp_landing]$easy_install south
Searching for south
Best match: South 0.8.1
Processing South-0.8.1-py2.4.egg
South 0.8.1 is already the active version in easy-install.pth

Using /home/ckoziak/lib/python2.4/South-0.8.1-py2.4.egg
Processing dependencies for south
Finished processing dependencies for south

但在此之前我运行pip install south并获得:

[ckoziak@web415 mvp_landing]$ls
join  manage.py  mvp_landing  static
[ckoziak@web415 mvp_landing]$pip install south
Traceback (most recent call last):
File "/home/ckoziak/bin/pip",line 7,in ?
sys.exit(
File "/usr/local/lib/python2.4/site-packages/pkg_resources.py",line 277,in       load_entry_point
return get_distribution(dist).load_entry_point(group,name)
File "/usr/local/lib/python2.4/site-packages/pkg_resources.py",line 2180,in load_entry_point
return ep.load()
File "/usr/local/lib/python2.4/site-packages/pkg_resources.py",line 1913,in load
entry = __import__(self.module_name,globals(),['__name__'])
File "/home/ckoziak/lib/python2.4/pip-1.4-py2.4.egg/pip/__init__.py",line 10,in ?
from pip.util import get_installed_distributions,get_prog
File "/home/ckoziak/lib/python2.4/pip-1.4-py2.4.egg/pip/util.py",line 17,in ?
from pip.vendor.distlib import version
File "/home/ckoziak/lib/python2.4/pip-1.4-py2.4.egg/pip/vendor/__init__.py",line 8
from __future__ import absolute_import
SyntaxError: from __future__ imports must occur at the beginning of the file

‘south’is在我的设置文件中.我有一个本地和现场版本__init__joining他们

__在里面__:

from .base import *

try:
    from .local import *
except:
    pass

try:
    from .live import *
except:
    pass

.local(设置文件),减去db信息:

MEDIA_ROOT = os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))),"static","media")

STATIC_ROOT =  os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))),"static-only")

STATICFILES_DIRS = (
    os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))),"static"),)

TEMPLATE_DIRS = (
    os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))),"templates"),)
INSTALLED_APPS = (
'django.contrib.auth','django.contrib.contenttypes','django.contrib.sessions','django.contrib.sites','django.contrib.messages','django.contrib.staticfiles',# Uncomment the next line to enable the admin:
'django.contrib.admin',# Uncomment the next line to enable admin documentation:
'django.contrib.admindocs','south','join',)

.live(设置文件)尚未设置数据库:

MEDIA_ROOT = os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))),)

INSTALLED_APPS = (
    'django.contrib.auth',# Uncomment the next line to enable the admin:
    'django.contrib.admin',# Uncomment the next line to enable admin documentation:
    'django.contrib.admindocs',)

解决方法

错误消息说您已安装到Python 2.4南部.

你应该安装南到python 2.7.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读