[python] Uninstall Django completely

I uninstalled django on my machine using pip uninstall Django. It says successfully uninstalled whereas when I see django version in python shell, it still gives the older version I installed.

To remove it from python path, I deleted the django folder under /usr/local/lib/python-2.7/dist-packages/.

However sudo pip search Django | more /^Django command still shows Django installed version. How do i completely remove it ?

This question is related to python django python-2.7 pip

The answer is


Got it solved. I missed to delete the egg_info files of all previous Django versions. Removed them from /usr/local/lib/python2.7/dist-packages. Also from /usr/lib/python2.7/dist-packages (if any present here)

sudo pip freeze| grep Django
sudo pip show -f Django
sudo pip search Django | more +/^Django

All above commands should not show Django version to verify clean uninstallation.


I used the same method mentioned by @S-T after the pip uninstall command. And even after that the I got the message that Django was already installed. So i deleted the 'Django-1.7.6.egg-info' folder from '/usr/lib/python2.7/dist-packages' and then it worked for me.


If installed Django using python setup.py install

python -c "import sys; sys.path = sys.path[1:]; import django; print(django.__path__)"

find the directory you need to remove, delete it


Remove any old versions of Django

If you are upgrading your installation of Django from a previous version, you will need to uninstall the old Django version before installing the new version.

If you installed Django using pip or easy_install previously, installing with pip or easy_install again will automatically take care of the old version, so you don’t need to do it yourself.

If you previously installed Django using python setup.py install, uninstalling is as simple as deleting the django directory from your Python site-packages. To find the directory you need to remove, you can run the following at your shell prompt (not the interactive Python prompt):

$ python -c "import django; print(django.path)"


I had to use pip3 instead of pip in order to get the right versions for the right version of python (python 3.4 instead of python 2.x)

Check what you got install at: /usr/local/lib/python3.4/dist-packages

Also, when you run python, you might have to write python3.4 instead of python in order to use the right version of python.


open the CMD and use this command :

**

pip uninstall django

**

it will easy uninstalled .


Use Python shell to find out the path of Django:

>>> import django
>>> django
<module 'django' from '/usr/local/lib/python2.7/dist-packages/django/__init__.pyc'>

Then remove it manually:

sudo rm -rf /usr/local/lib/python2.7/dist-packages/django/

The Issue is with pip --version or python --version.

try solving issue with pip2.7 uninstall Django command

If you are not able to uninstall using the above command then for sure your pip2.7 version is not installed so you can follow the below steps:

1)which pip2.7 it should give you an output like this :

/usr/local/bin/pip2.7

2) If you have not got this output please install pip using following commands

$ wget https://bootstrap.pypa.io/get-pip.py
$ sudo python2.7 get-pip.py

3) Now check your pip version : which pip2.7 Now you will get

/usr/local/bin/pip2.7 as output 

4) uninstall Django using pip2.7 uninstall Django command.

Problem can also be related to Python version. I had a similar problem, this is how I uninstalled Django.

Issue occurred because I had multiple python installed in my virtual environment.

$ ls

activate       activate_this.py  easy_install-3.4  pip2.7  python     python3        wheel
activate.csh   easy_install      pip               pip3    python2    python3.4
activate.fish  easy_install-2.7  pip2              pip3.4  python2.7  python-config

Now when I tried to un-install using pip uninstall Django Django got uninstalled from python 2.7 but not from python 3.4 so I followed the following steps to resolve the issue :

1)alias python=/usr/bin/python3

2) Now check your python version using python -V command

3) If you have switched to your required python version now you can simply uninstall Django using pip3 uninstall Django command

Hope this answer helps.


pip search command does not show installed packages, but search packages in pypi.

Use pip freeze command and grep to see installed packages:

pip freeze | grep Django

On Windows, I had this issue with static files cropping up under pydev/eclipse with python 2.7, due to an instance of django (1.8.7) that had been installed under cygwin. This caused a conflict between windows style paths and cygwin style paths. So, unfindable static files despite all the above fixes. I removed the extra distribution (so that all packages were installed by pip under windows) and this fixed the issue.


Examples related to python

programming a servo thru a barometer Is there a way to view two blocks of code from the same file simultaneously in Sublime Text? python variable NameError Why my regexp for hyphenated words doesn't work? Comparing a variable with a string python not working when redirecting from bash script is it possible to add colors to python output? Get Public URL for File - Google Cloud Storage - App Engine (Python) Real time face detection OpenCV, Python xlrd.biffh.XLRDError: Excel xlsx file; not supported Could not load dynamic library 'cudart64_101.dll' on tensorflow CPU-only installation

Examples related to django

How to fix error "ERROR: Command errored out with exit status 1: python." when trying to install django-heroku using pip Pylint "unresolved import" error in Visual Studio Code Is it better to use path() or url() in urls.py for django 2.0? Unable to import path from django.urls Error loading MySQLdb Module 'Did you install mysqlclient or MySQL-python?' ImportError: Couldn't import Django Django - Reverse for '' not found. '' is not a valid view function or pattern name Class has no objects member Getting TypeError: __init__() missing 1 required positional argument: 'on_delete' when trying to add parent table after child table with entries How to switch Python versions in Terminal?

Examples related to python-2.7

Numpy, multiply array with scalar Not able to install Python packages [SSL: TLSV1_ALERT_PROTOCOL_VERSION] How to create a new text file using Python Could not find a version that satisfies the requirement tensorflow Python: Pandas pd.read_excel giving ImportError: Install xlrd >= 0.9.0 for Excel support Display/Print one column from a DataFrame of Series in Pandas How to calculate 1st and 3rd quartiles? How can I read pdf in python? How to completely uninstall python 2.7.13 on Ubuntu 16.04 Check key exist in python dict

Examples related to pip

How to fix error "ERROR: Command errored out with exit status 1: python." when trying to install django-heroku using pip "E: Unable to locate package python-pip" on Ubuntu 18.04 How to Install pip for python 3.7 on Ubuntu 18? What is the meaning of "Failed building wheel for X" in pip install? Could not install packages due to an EnvironmentError: [Errno 13] How do I install Python packages in Google's Colab? Conda version pip install -r requirements.txt --target ./lib pip: no module named _internal AttributeError: Module Pip has no attribute 'main' Error after upgrading pip: cannot import name 'main'