如何重设virtualenv和pip? [英] How to reset virtualenv and pip?

查看:57
本文介绍了如何重设virtualenv和pip?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Ubuntu 10.04服务器上安装了virtualenv.

I installed virtualenv on my Ubuntu 10.04 server.

现在,当我进行点冻结时,它会向我显示以下软件包:

Now when I do pip freeze it shows me the following packages:

Django==1.2.4
distribute==0.6.10
python-apt==0.7.94.2ubuntu6.2
virtualenv==1.5.1
wsgiref==0.1.2

当我点点卸载Django"时说:

When I do "pip uninstall Django" it says:

pip uninstall Django
Uninstalling Django:
Proceed (y/n)? y
Successfully uninstalled Django

理想情况下,这应该卸载Django,但不能卸载.当我进行点冻结"时,仍然可以看到相同的软件包.

Ideally this should uninstall Django but it doesn't. I can still see the same packages when I do "pip freeze".

现在让我忍受,另一个奇怪的事情是,当我创建一个virtualenv然后在其中进行"pip冻结"时,我只看到一个包,那就是"wsgiref",这很奇怪,因为它在理想情况下应该为空白.

Now bear with me, the other weird thing is that when I create a virtualenv and then do "pip freeze" inside it, I see only one package and that is "wsgiref" which is weird because it should ideally be blank.

此外,尽管使用--no-site-packages创建了virtualenv,我仍然可以使用"django-admin.py startproject"创建一个新的django项目.

Also, in spite of creating this virtualenv with --no-site-packages I can still create a new django project with "django-admin.py startproject".

当我在此virtualenv中启动python解释器并执行导入django"时,出现错误没有名为django的模块".

When I start python interpreter inside this virtualenv and do "import django" it gives me the error "No module named django".

此外,当我尝试在virtualenv内安装"pip install Django"时,它会请求sudo权限,这在理想情况下不会发生.

Also when I try to install "pip install Django" inside the virtualenv it asks for sudo permissions which shouldn't happen ideally.

我如何解决这个混乱局面.有什么办法可以重置所有的pep和virtualenv吗?

How do I sort out this mess. Any way to just reset everything pep and virtualenv?

推荐答案

据我所知,venv的 only 目的是管理依赖项.

As far as I can tell, the only purpose of a venv is to manage dependencies.

您应该放心,使用 virtualenv venv deactivate venv,删除它,然后创建一个新的venv;来源venv/bin/activate .

You should be safe to just deactivate the venv, delete it, and create a new one using virtualenv venv; source venv/bin/activate.

这将为您重新开始.

这篇关于如何重设virtualenv和pip?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆