【发布时间】:2014-12-14 21:05:12
【问题描述】:
我已经在虚拟环境中安装了 Django,但是当我调用包时,它没有显示出来。
$ pip install django
Downloading/unpacking django
Downloading Django-1.7.1-py2.py3-none-any.whl (7.4MB): 7.4MB downloaded
Installing collected packages: django
Successfully installed django
Cleaning up...
$ python
Python 2.7.6 (default, Sep 9 2014, 15:04:36)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import django
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named django
如何在我的虚拟环境中找到我的 Django 安装?
【问题讨论】:
-
你激活你的虚拟环境了吗?
source bin/activate在 mac 和\path\to\env\Scripts\activate在 windows... -
enter code here是错误消息的一部分还是粘贴到此处的代码后留下的? -
是的,我去掉了这个名字,但我确实激活了它。
-
当你看到
pip list时你会看到django吗? -
(venv)-MacBook-Pro:my_project_folder j$ pip list Django (1.7.1) pip (1.5.6) setuptools (3.6) wsgiref (0.1.2)
标签: python django pip virtualenv