简体   繁体   中英

How do you arrange your site-packages folder in python

I just downloaded django and installed it into C:\\Python27\\Lib\\site-packages So now my site-packages directory seems rather unorganized with 5 separate folders a bunch ot text files and a python script. Should I create a sub directory in site-packages for the django package and store everything in there? If I do that will the python intrepeter know to look in the Django directory in the site-packages directory for the django package? Or will I have to change some environment variables around?

Thank you.

I'm not sure if you're asking it because this is something you need to know because of some complex setting you have. In case you are just want to install Django, you should follow the install instructions from their site :

pip install Django

the directory order in site-packages is an internal mechanism of your Python build and I don't think you should change it, unless you want to create your own package and want to learn more on how python find installed packages (and if this is the case I would start reading this document: http://docs.python.org/2/distutils/index.html )

As suggested in the comments to your question, and also in the documentation of Django , you should consider using virtualenv , especially when developing a webapp which will get deployed on a server with a specific Django version. Over time you'll see that you want to create other apps that require different versions of modules, and to still support the already existing apps you will need to use virtualenv.

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