删除 Django 因为我现在正在使用 VirtualEnv

remove Django because I am now using VirtualEnv

我已经使用 Django 和 python 几个星期了,现在我决定硬着头皮使用 virtualenv。显然我应该从一开始就这样做,但由于各种配置问题,我没有这样做。

现在当我尝试将 Django 安装到 virtualenv 时,它不起作用。查看脚本目录,我有 pip、easy_install 和 python 但没有 django-admin.py 文件。我已经检查了几个教程,但没有运气。

我得到的输出是:

(gesplosh) PS C:\Users\nicka_000\documents\coding\websites_go_here\gesplosh>      easy_install Django
Searching for Django
Best match: django 1.7.6
Processing django-1.7.6-py2.7.egg
Adding django 1.7.6 to easy-install.pth file

Using   c:\users\nicka_000\documents\coding\websites_go_here\gesplosh\lib\site-    packages\django-1.7.6-py2.7.egg
Processing dependencies for Django
Finished processing dependencies for Django
 (gesplosh) PS       C:\Users\nicka_000\documents\coding\websites_go_here\gesplosh> dir


Directory: C:\Users\nicka_000\documents\coding\websites_go_here\gesplosh


Mode                LastWriteTime     Length Name
----                -------------     ------ ----
d----        02/12/2014     08:49            Include
d----        18/03/2015     10:22            Lib
d----        18/03/2015     10:23            Scripts

当我进入脚本目录时,我有这个:

C:\Users\nicka_000\documents\coding\websites_go_here\gesplosh\Scripts


Mode                LastWriteTime     Length Name
----                -------------     ------ ----
-a---        18/03/2015     10:23       2379 activate
-a---        18/03/2015     10:23        596 activate.bat
-a---        18/03/2015     10:23       8252 activate.ps1
-a---        18/03/2015     10:23       1129 activate_this.py
-a---        18/03/2015     10:23        348 deactivate.bat
-a---        18/03/2015     10:22      95138 easy_install-2.7.exe
-a---        18/03/2015     10:22      95138 easy_install.exe 
-a---        18/03/2015     10:23      95110 pip.exe 
-a---        18/03/2015     10:23      95110 pip2.7.exe
-a---        18/03/2015     10:23      95110 pip2.exe
-a---        18/03/2015     10:22      26624 python.exe
-a---        18/03/2015     10:22      27648 pythonw.exe

感觉好像我错过了在我的虚拟环境中安装 Django 的步骤,但 none 我看过的教程似乎需要做任何其他事情。我需要做什么才能在我的虚拟目录中安装 Django?

感谢您的帮助

当你在 virtualenv 中工作时,你应该使用 pip 来安装包。所以,不要 easy_install,而是:

pip install django

这应该将 Django 安装到 virtualenv 而不是系统范围,你应该已经准备就绪。