I have installed Django and loads of other apps with it. I am using Ubuntu, and I didn't initially use virtualenv
so all the Django stuff are in my /user/local/lib/python2.6/dist-packagaes
. Whereas my project is in Alex/workplace/projectx/src开发者_运维知识库
. I have Alex/workplace/projectx/projectx-env
. How can I move all my Django stuff from their installed location to my project virtualenv
folder?
I am doing this because I want to install git in the project x so if I change something in one of the Django apps, I can merge them later on.
You can use pip freeze > dependencies.txt
while not in the virtualenv to get a list of all the installed packages in your system site-packages. Pare the dependencies.txt
file down to just what you need, and inside your virtualenv run pip install -r dependencies.txt
.
This method lets you take a subset of the installed packages and also install them in the virtualenv. This way is a whole lot safer than copying files from the system packages to your virtualenv's packages.
精彩评论