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

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?



Same here, can anyone help?

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hi there,

I just came across this question. If you are running your app in a virtual environment, have you tried activating it?

. myenv/bin/activate

You could also try installing the dependencies with:

pip install -r requirements.txt

Regards, Bobby