简体   繁体   中英

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?

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.

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