简体   繁体   中英

Trying to install Django reversion

I'm trying to setup a Django project but Im getting this:

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:

$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.

That Python3-only open() was added with version 3.0.6. Try earlier versions, 3.0.5 or 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.

Here is the official Django 3.0 release notes

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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