如何使用pip3或其他方式干净地卸载我的python包? [英] how to cleanly uninstall my python packages with pip3 or any other way?

查看:956
本文介绍了如何使用pip3或其他方式干净地卸载我的python包?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是用于安装python程序的setup.py文件,使用python3 setup.py install安装后,创建了一个名为testmain的程序条目,当我执行pip3 freeze时,其输出中显示abc==0.1,所以我用带pip3 uninstall abc的pip3卸载了它,尽管软件包被卸载了,但是我的路径上仍然存在条目testmain,有没有一种方法可以使pip3在卸载过程中也删除该条目,或者我可以干净的其他任何方式在相同情况下卸载我的程序?

this is my setup.py file for installing my python program, after the installation using python3 setup.py install an entry to my program was created named testmain , when i did pip3 freeze it showed abc==0.1 in its output ,so i uninstalled it using pip3 with pip3 uninstall abc , though the packages were uninstalled but there still existed the entry testmain on my path , is there a way that pip3 also removes this entry during the uninstall or any other way that i can cleanly uninstall my programs under same scenario ?

from setuptools import setup

setup(name='abc',
      version='0.1',
      description='test',
      url='http://github.com/rjdp',
      author='rajdeep',
      author_email='rajdeep.sharma@rtcamp.com',
      license='MIT',
      packages=['cli'],
      install_requires=[
      'cement',
      ],
      entry_points = {
      'console_scripts': ['testmain=cli.abc:main'],
      },
      zip_safe=False)

推荐答案

代替python3 setup.py安装使用:

Instead of python3 setup.py install use:

pip3 install .

然后

pip3 uninstall abc

这将删除testmain.

This will remove testmain.

我今天有同样的问题,整个上午都在努力弄清楚为什么无法卸载该脚本.直到我在这里看到Ramana的答案之前,什么都没做: https ://askubuntu.com/questions/38692/how-does-one-remove-applications-installed-through-python-setup-py-install

I had the same question today and spent the entire morning trying to figure out why the script wouldn't uninstall. Nothing worked until I saw Ramana's answer here: https://askubuntu.com/questions/38692/how-does-one-remove-applications-installed-through-python-setup-py-install

您应始终使用"pip"安装Python应用程序.pip支持卸载选项."以及其中的示例如何支持本地路径.

"You should always install Python apps with "pip". pip supports uninstall option." and the example in the commment on how local path is supported.

这篇关于如何使用pip3或其他方式干净地卸载我的python包?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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