![正确卸载python软件](https://linux22.com/image/37152/%E6%AD%A3%E7%A1%AE%E5%8D%B8%E8%BD%BDpython%E8%BD%AF%E4%BB%B6.png)
我安装了一些Python软件(皮卡尔达夫)之前注意到有一个 Debian sid 的打包版本...
现在,我想正确卸载这个软件,然后使用apt安装打包版本。
这是我安装 pycarddav 的方法(遵循其文档):
- 下载 pycarddav 并解压
- 转到包含
python setup.py install
以下内容的文件夹并启动:
#!/usr/bin/env python2
import os
import string
import subprocess
import sys
import warnings
#from distutils.core import setup
from setuptools import setup
MAJOR = 0
MINOR = 7
PATCH = 0
RELEASE = True
VERSION = "{0}.{1}.{2}".format(MAJOR, MINOR, PATCH)
if not RELEASE:
try:
try:
pipe = subprocess.Popen(["git", "describe", "--dirty", "--tags"],
stdout=subprocess.PIPE)
except EnvironmentError:
warnings.warn("WARNING: git not installed or failed to run")
revision = pipe.communicate()[0].strip().lstrip('v')
if pipe.returncode != 0:
warnings.warn("WARNING: couldn't get git revision")
if revision != VERSION:
revision = revision.lstrip(string.digits + '.')
VERSION += '.dev' + revision
except:
VERSION += '.dev'
warnings.warn("WARNING: git not installed or failed to run")
def write_version():
"""writes the pycarddav/version.py file"""
template = """\
__version__ = '{0}'
"""
filename = os.path.join(
os.path.dirname(__file__), 'pycarddav', 'version.py')
with open(filename, 'w') as versionfile:
versionfile.write(template.format(VERSION))
print("wrote pycarddav/version.py with version={0}".format(VERSION))
write_version()
requirements = [
'lxml',
'vobject',
'requests',
'urwid',
'pyxdg'
]
if sys.version_info[:2] in ((2, 6),):
# there is no argparse in python2.6
requirements.append('argparse')
setup(
name='pyCardDAV',
version=VERSION,
description='A CardDAV based address book tool',
long_description=open('README.rst').read(),
author='Christian Geier',
author_email='[email protected]',
url='http://lostpackets.de/pycarddav/',
license='Expat/MIT',
packages=['pycarddav', 'pycarddav.controllers'],
scripts=['bin/pycardsyncer', 'bin/pc_query', 'bin/pycard-import'],
requires=requirements,
install_requires=requirements,
classifiers=[
"Development Status :: 4 - Beta",
"License :: OSI Approved :: MIT License",
"Environment :: Console :: Curses",
"Intended Audience :: End Users/Desktop",
"Operating System :: POSIX",
"Programming Language :: Python :: 2 :: Only",
"Topic :: Utilities",
"Topic :: Communications :: Email :: Address Book"
],
)
我该如何正确删除它?
pip uninstall pycarddav
即使我没有使用 pip 进行安装也可以使用吗?
答案1
根据文档pip
无法卸载这些类型的安装。
摘录-http://pip.readthedocs.org/en/latest/reference/pip_uninstall.html
pip 能够卸载大多数已安装的软件包。已知的例外情况有:
- 随 一起安装的纯 distutils 软件包
python setup.py install
,不会留下任何元数据来确定安装了哪些文件。- 由安装的脚本包装器
python setup.py develop
。