Report this

What is the reason for this report?

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

Posted on May 14, 2018

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 manage.py makemigrations” I got this error:

Traceback (most recent call last):
  File "manage.py", line 8, in <module>
    from django.core.management 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 "manage.py", 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?

Thanks!



This textbox defaults to using Markdown to format your 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

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.