Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
901 views
in Technique[技术] by (71.8m points)

pip / virtualenv / django installation issue

I'm on a new virtualenv, and trying to install django on it.

When I type, which django-admin.py I get back /usr/local/bin/django-admin.py which is not correct, it should be installing inside the .virtualenvs folder.

If I do, pip install django I get back:

Requirement already satisfied (use --upgrade to upgrade): django in /Library/Python/2.6/site-packages

If I do, pip uninstall django I get back:

Not uninstalling Django at /Library/Python/2.6/site-packages, outside environment /Users/username/.virtualenvs/envname/bin/..

How do I get pip to install and use django inside the virtualenv? No idea how to troubleshoot this.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

First, you should be setting up the virtualenv with --no-site-packages:

virtualenv --no-site-packages …/my-env/

Then you should make sure that you've activated it:

. …/my-env/bin/activate

Or, with virtualenv helper:

workon my-env

Then install Django with:

pip install django

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...