pip / virtualenv / django installation issue

前端 未结 2 1251
醉梦人生
醉梦人生 2020-12-16 00:23

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

相关标签:
2条回答
  • 2020-12-16 01:17

    Like David pointed out, you should tell virtualenv not to use packages outside your virtual environment (using the --no-site-packages flag). That's why "which django-admin.py" returns "/usr/local/bin/django-admin.py"

    0 讨论(0)
  • 2020-12-16 01:28

    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
    
    0 讨论(0)
提交回复
热议问题