消失的点子

时间:2016-02-25 09:51:45

标签: python django pip virtualenv

为什么模块已经安装但没有看到?

foo@bar:~/PycharmProjects/my$ virtualenv env
New python executable in /home/foo/PycharmProjects/my/env/bin/python
Installing setuptools, pip, wheel...done.
foo@bar:~/PycharmProjects/my$ source ./env/bin/activate
(env) foo@bar:~/PycharmProjects/my$ pip install django
Traceback (most recent call last):
  File "/home/pavel/PycharmProjects/my/env/bin/pip", line 7, in <module>
    from pip import main
ImportError: No module named pip

(env) foo@bar:~/PycharmProjects/my$ which pip
  /home/foo/PycharmProjects/my/env/bin/pip

1 个答案:

答案 0 :(得分:0)

如果您已经激活了virtualenv,则将其停用

(env)foo@bar:~/PycharmProjects/my$ deactivate

并尝试使用不同的名称创建virtualenv

foo@bar:~/PycharmProjects/my$ virtualenv venv

然后使用此命令激活virtualenv

foo@bar:~/PycharmProjects/my$ source venv/bin/activate

现在看起来应该是这样的

(venv) foo@bar:~/PycharmProjects/my$

最后你可以安装包

(venv) foo@bar:~/PycharmProjects/my$ pip install django