如何删除使用distutils安装的程序? [英] How remove a program installed with distutils?
问题描述
我已经使用以下setup.py安装了python应用程序:
I have installed a python application with this setup.py:
#!/usr/bin/env python
from distutils.core import setup
from libyouandme import APP_NAME, APP_DESCRIPTION, APP_VERSION, APP_AUTHORS, APP_HOMEPAGE, APP_LICENSE
setup(
name=APP_NAME.replace(" ","-").lower(),
version=APP_VERSION,
description=APP_DESCRIPTION,
author="John G",
author_email="xxx@gmail.com",
url=APP_HOMEPAGE,
license=APP_LICENSE,
scripts=["youandme.py"],
packages=["libyouandme"],
data_files=[
('share/applications', ['youandme.desktop']),
('usr/share/icons/hicolor/16x16/apps', ['icons/hicolor/16x16/apps/you.png']),
('usr/share/icons/hicolor/22x22/apps', ['icons/hicolor/22x22/apps/you.png']),
('usr/share/icons/hicolor/48x48/apps', ['icons/hicolor/48x48/apps/you.png'])],
)
如何删除
我可以使用distutils吗?
Do I can do this with distutils ?
推荐答案
安装checkinstall Ubuntu软件包。 checkinstall
监视安装过程并创建一个deb软件包。这样,您就可以使用常规的软件包管理命令删除该软件。
Install the checkinstall Ubuntu package. checkinstall
monitors the installation procedure and creates a deb package. This lets you use regular package management commands to remove the software.
首先,使用checkinstall重新安装候选python模块/软件包。将目录更改为包含候选python模块/软件包的setup.py文件的目录:
First, reinstall the candidate python module/package using checkinstall. Change directory to the directory containing the setup.py file of the candidate python module/package:
cd <PACKAGE_NAME>
然后:
sudo checkinstall -D --fstrans=no python setup.py install
这将创建.deb软件包,然后再次安装python模块。
会问您几个问题。默认答案应该很好。
(但是,当setup.py文件位于python模块的子目录中,例如 source子目录中时,您可以更改.deb软件包的名称。)
This creates a .deb package, and installs the python module again. You'll be asked a few questions. The default answers should be fine. (But you might change the "name" of the .deb package, when the setup.py file is in a subdirectory of the python module, for example the "source" subdirectory.)
(保存的.deb软件包现在可以捕获python软件包的安装方式,而dpkg可以删除python软件包。)
(The saved .deb package now captures how the python package installed itself, and dpkg can remove the python package.)
然后立即删除模块:
sudo dpkg -r <PACKAGE_NAME>
PS。我听说有些安装程序与 checkinstall
不兼容,尽管我自己从未遇到任何问题。
PS. I've heard that some installation programs are not compatible with checkinstall
, though I've never run into any problems myself.
这篇关于如何删除使用distutils安装的程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!