David H
David H

Reputation: 55

PYTHONPATH environment variable

My virtual-environment worked perfectly until I upgraded to Ubuntu 22.04 LTS. But when I upgraded the virtual environment is not working any longer. It gives this message:

 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?

I did activate it as I used to do before, with

workon myenvironment

and I tried also with

 source myenvironment/bin/activate

but none of them seems to work. I get always the same message.

I deleted the environment and created a new one but I still get the same message.

And Django is also installed, so the only missing thing I haven't check is the PHYTHONPATH environment variable, but I do not know if I could change it somehow and even if I would know it, I wouldn't know what should it look like.

What should I do to fix this? Do I have to do anything special after upgrading to Ubuntu 22.04 LTS to keep my virtualenvironments working?

Upvotes: 0

Views: 237

Answers (1)

David H
David H

Reputation: 55

Even when on ubuntu 18 before running the server with:

     python3 manage.py runserver 

I had to activate virtualenvironment with:

    workon myenvironment

With Ubuntu 22.04 it seems it is not necessary and runserver will work without activating virtualenvironment. I don't understand why, but it works.

Upvotes: 1

Related Questions