Python Can';t卸载没有软件包的项目
在尝试为另一个问题构建MCVE时,我创建了一个Python Can';t卸载没有软件包的项目,python,pip,Python,Pip,在尝试为另一个问题构建MCVE时,我创建了一个example目录,其中包含一个文件setup.py,包含以下内容: from setuptools import setup setup( name='example', ) 并安装了 python3.6 setup.py sdist python3.6 -m pip install --user dist/example-0.0.0.tar.gz 没有实际的软件包或模块,但安装了一些东西: redacted:~/example>
example
目录,其中包含一个文件setup.py
,包含以下内容:
from setuptools import setup
setup(
name='example',
)
并安装了
python3.6 setup.py sdist
python3.6 -m pip install --user dist/example-0.0.0.tar.gz
没有实际的软件包或模块,但安装了一些东西:
redacted:~/example> python3.6 -m pip list | grep example
DEPRECATION: The default format will switch to columns in the future. You can use --format=(legacy|columns) (or define a format=(legacy|columns) in your pip.conf under the [list] section) to disable this warning.
example (0.0.0)
现在我无法卸载它:
redacted:~/example> python3.6 -m pip uninstall example
Can't uninstall 'example'. No files were found to uninstall.
建议可能有一个.pth
文件我必须从我的网站包
目录中删除,但我没有看到任何:
redacted:~/example> find ~/.local/lib/python3.6/site-packages/ -name '*.pth'
redacted:~/example>
我刚才对我的系统做了什么,如何撤消它?由于您没有指定任何文件,因此没有要安装的内容。所以你也不能卸载任何东西。看起来这可能没有安装任何东西。甚至元数据都没有,尽管一开始看起来是这样的 以
python3.6-m pip
而不是pip3.6
运行pip会将当前目录放在导入路径上-在我的例子中,当前目录是带有setup.py
和由python3.6 setup.py sdist构建的目录。pip搜索导入路径以查找已安装的包,当它运行到空项目的元数据中时,它会感到困惑。似乎发现此处列出的所有0个文件都已安装,因此必须安装项目
在同一目录中运行python2.7-mpiplist
也会为example(0.0.0)
生成一个条目,尽管我肯定没有在2.7上安装它。运行pip2.7列表
或pip3.6列表
不会显示该条目。从不同目录运行python2.7-m pip list
或python3.6-m pip list
也不会显示以下条目:
redacted:~/example> python2.7 -m pip list 2>&1 | grep example
example (0.0.0)
redacted:~/example> python3.6 -m pip list 2>&1 | grep example
example (0.0.0)
redacted:~/example> pip2.7 list 2>&1 | grep example
redacted:~/example> pip3.6 list 2>&1 | grep example
redacted:~/example> cd
redacted:~> python2.7 -m pip list 2>&1 | grep example
redacted:~> python3.6 -m pip list 2>&1 | grep example
redacted:~>
有了这个输出,我想我不需要做任何事情来卸载这个软件包。它做了些什么python3.6-m pip列表
显示了示例(0.0.0)
的一个条目,表示它已安装。@user2357112是的,但pip找不到任何文件,可能只是在某些pip清单中