V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
poke707
V2EX  ›  Python

关于 pip uninstall 不干净

  •  
  •   poke707 ·
    Ginhing · 2014-07-10 15:36:54 +08:00 · 19096 次点击
    这是一个创建于 3579 天前的主题,其中的信息可能已经有所发展或是发生改变。
    有些package通过sudo pip install到/usr/local/lib/和/usr/local/bin去,
    然而pip uninstall的时候只能删掉一部分(好像只卸了个egg),之后pip list还是可以列出来..
    例如 cython,用pip卸载之后cython都还可以用,但再执行pip uninstall cython则报错:Can't uninstall 'Cython'. No files were found to uninstall.

    这种情况是我的pip问题还是package没提供好卸载方案的问题?
    如果是后者,我能想的只是从setup.py里分析都有哪些文件安装进去,再找出来rm,想知道有不这么累的方法吗
    5 条回复    2014-07-10 18:37:39 +08:00
    hslx111
        1
    hslx111  
       2014-07-10 16:16:16 +08:00   ❤️ 1
    pip 官方文档里面有说明,pip uninstall 能够卸载大部分的包,但如果你是通过python setup.py install 来安装的话,它是不能够卸载完全的。
    目前来看还是手动来做的:
    如果你不知道具体的文件,就重新装一遍,用--record记录,然后再rm
    python setup.py install --record files.txt
    cat files.txt | xargs rm -rf
    poke707
        2
    poke707  
    OP
       2014-07-10 16:27:02 +08:00
    @hslx111 感谢回答,pip文档的确没看过,只是google乱搜一通@_@
    这么说的话,pip install <package>的大部分都能干净uninstall吗
    hslx111
        3
    hslx111  
       2014-07-10 16:45:26 +08:00
    @poke707 我随便找了个包pip install试了下是可以的,你可以自己试一下
    poke707
        4
    poke707  
    OP
       2014-07-10 17:44:10 +08:00
    @hslx111 我试了pip install bottle 是不干净的
    poke707
        5
    poke707  
    OP
       2014-07-10 18:37:39 +08:00
    @hslx111 原因是我pip版本低了,升到1.5.1可以了卸bottle了
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   4838 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 31ms · UTC 03:59 · PVG 11:59 · LAX 20:59 · JFK 23:59
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.