简体   繁体   English

尝试安装 Django 反转

[英]Trying to install Django reversion

I'm trying to setup a Django project but Im getting this:我正在尝试设置一个 Django 项目,但我得到了这个:

python2.7 manage.py migrate
Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 364, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 338, in execute
    django.setup()
  File "/usr/local/lib/python2.7/dist-packages/django/__init__.py", line 27, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/usr/local/lib/python2.7/dist-packages/django/apps/registry.py", line 85, in populate
    app_config = AppConfig.create(entry)
  File "/usr/local/lib/python2.7/dist-packages/django/apps/config.py", line 94, in create
    module = import_module(entry)
  File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
ImportError: No module named reversion

So I'm trying to instal reversion, but I'm getting this error message when trying to install enter code here it:所以我正在尝试安装reversion,但是在尝试安装enter code here时收到此错误消息:

$sudo pip install django-reversion
Downloading/unpacking django-reversion
  Downloading django-reversion-3.0.7.tar.gz (67kB): 67kB downloaded
  Running setup.py (path:/tmp/pip_build_root/django-reversion/setup.py) egg_info for package django-reversion
    Traceback (most recent call last):
      File "<string>", line 17, in <module>
      File "/tmp/pip_build_root/django-reversion/setup.py", line 28, in <module>
        long_description=read('README.rst'),
      File "/tmp/pip_build_root/django-reversion/setup.py", line 19, in read
        with open(filepath, "r", encoding="utf-8") as f:
    TypeError: 'encoding' is an invalid keyword argument for this function
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):

  File "<string>", line 17, in <module>

  File "/tmp/pip_build_root/django-reversion/setup.py", line 28, in <module>

    long_description=read('README.rst'),

  File "/tmp/pip_build_root/django-reversion/setup.py", line 19, in read

    with open(filepath, "r", encoding="utf-8") as f:

TypeError: 'encoding' is an invalid keyword argument for this function

----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /tmp/pip_build_root/django-reversion
Storing debug log for failure in /home/tirengarfio/.pip/pip.log

I'm on Ubuntu 16.04 and python 2.7.我在 Ubuntu 16.04 和 python 2.7 上。

That Python3-only open() was added with version 3.0.6.仅 Python3 的open()是在 3.0.6 版中添加的。 Try earlier versions, 3.0.5 or 3.0.4:尝试早期版本,3.0.5 或 3.0.4:

pip install django-reversion==3.0.5

or或者

pip install django-reversion==3.0.4

Django 3 supports python versions 3.6 and above. Django 3 支持 python 版本 3.6 及更高版本。

Here is the official Django 3.0 release notes这是官方的 Django 3.0 发行说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM