How to tell if you have multiple Django's inst

2019-06-17 12:04发布

问题:

In the process of trying to install django, I had a series of failures. I followed many different tutorials online and ended up trying to install it several times. I think I may have installed it twice (which the website said was not a good thing), so how do I tell if I actually have multiple versions installed? I have a Mac running Lion.

回答1:

open terminal and type python then type import django then type django and it will tell you the path to the django you are importing. Goto that folder [it should look something like this: /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/] and look for more than one instance of django(if there is more than one, they will be right next to each other). Delete the one(s) you don't want.



回答2:

You could install yolk - it will list all your python packages if you call it ('yolk -l')

Also it is worth while looking into virtualenv as maxi suggested. It basically allows you to have different python configurations (i.e. packages installed...) and makes it easy to switch between them.

Additionally, it seems you might have been installing django manually. I would suggest checking out pip and setuptools (aka easy_install), two very popular python package management utilities.



回答3:

Check out virtualenv and virtualenvwrapper