django-admin --version can not find installed version

I have installed latest django(2.2) using pip3 command. Although it is successfully installed I getting below error for the command-

django-admin --version
Error: Cannot find installed version of python-django or python3-django.
Same error I am getting while going to create a project using start project.

I have also tried to solve this problem after seeing some similar question in this platform by installing django with apt-get command, but it installs django 1.1 not 2.2.

1 Answer

One reason you cannot find the Django is because you installed it in one virtual environment and now looking for it in another place.So suppose you are in the directory Codes. $ cd Codes

Then first you create a virtual environment:

$ virtualenv env

Then you activate the virtual environment:

$ source env/bin/activate

Once activated, your terminal will look like this: (env) $Now install django inside env:

(env) $ pip install django

SO you have Django INSIDE THIS env, each time you want django, you need to activate this env. So suppose, you close this terminal and open a new terminal:

Then you 1st activate the environment:

$ cd Codes
$ source env/bin/activate # <--- do this whenever you need django
(env)$ django-admin --version
2.2.7 # <--- django version

I hope this works.

1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like