Can't run a Django console after installing a new version of Python

May 14, 2018 545 views
Python Django Ubuntu 16.04

After uploading to a droplet a Django project I realized that I was using new functionality like f' strings that aren't supported on the 3.5 I proceed to install Python 3.6.3.

It looks like the installation is successful. When I write "python3 -V" on the console it answers back Python 3.6.3.

When typing "pip freeze" it appears Django==2.0.4 .

The problem comes when typing "python3 makemigrations" I got this error:

Traceback (most recent call last):
  File "", line 8, in <module>
    from import execute_from_command_line
ModuleNotFoundError: No module named 'django'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "", line 14, in <module>
    ) from exc
ImportError: Couldn't import Django. Are you sure it's installed and available on your PYTHONPATH environment variable? Did you forget to activate a virtual environment?

Any ideas about how to make this work?


Be the first one to answer this question.