在为另一个问题构建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> 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.
Other posts建议可能有一个.pth
文件我必须从site-packages
目录中删除,但我没有看到任何文件:
redacted:~/example> find ~/.local/lib/python3.6/site-packages/ -name '*.pth'
redacted:~/example>
我刚才对我的系统做了什么,我怎样才能撤消它?你知道吗
因为您没有指定任何文件,所以没有要安装的文件。所以你也不能卸载任何东西。你知道吗
看起来这个可能没有安装任何东西。甚至元数据都没有,尽管一开始看起来是这样。你知道吗
将pip作为
python3.6 -m pip
而不是pip3.6
运行会将当前目录放在导入路径上—在我的示例中,当前目录是具有setup.py
和由python3.6 setup.py sdist
构建的目录的目录。pip搜索导入路径以查找已安装的包,当它运行到空项目的元数据中时,它会感到困惑。似乎发现此处列出的所有0个文件都已安装,因此必须安装该项目。你知道吗在同一目录中运行
python2.7 -m pip list
也会为example (0.0.0)
生成一个条目,尽管我肯定没有在2.7上安装它。运行pip2.7 list
或pip3.6 list
不会显示条目。从其他目录运行python2.7 -m pip list
或python3.6 -m pip list
也不会显示条目:考虑到这个输出,我不认为我需要做任何事情来卸载这个包。你知道吗
相关问题 更多 >
编程相关推荐