pip 如何删除带有前导破折号的错误安装的软件包:“-pkgname" [英] pip how to remove incorrectly installed package with a leading dash: "-pkgname"

查看:59
本文介绍了pip 如何删除带有前导破折号的错误安装的软件包:“-pkgname"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

输入 pip freeze 我注意到列表顶部有以下警告:

<块引用>

警告:无法解析要求:-atplotlib

所以我使用:pip list 检查了已安装的软件包而且,确实以下内容被认为是一个包:

 包版本--------------- --------atplotlib 3.0.3

我想我在安装/升级 matplotlib 时可能有错别字,导致安装了上述包".

不幸的是,我无法在输入时将其删除

pip uninstall -atplotlib

作为命令读取并返回以下错误:没有这样的选项:-a.关于如何进行的任何建议?

编辑

我找到了以下文件夹:

<块引用>

C:Users ameAnaconda3Libsite-packages~atplotlib

C:Users ameAnaconda3Libsite-packages~atplotlib-3.0.3-py3.7.egg-info

移除它们是否安全(且足够)?

解决方案

根据 此链接,由 Lawrence 在 中提供他的回答

在您的 site-package 目录中查找并删除错误命名的文件夹应该可以解决问题.

如果这还不够,请按照以下说明继续清洁.

搜索损坏的包的名称(没有前导破折号)让我找到了以下两个文件夹:

<块引用>

C:Users ameAnaconda3Libsite-packages~atplotlib

<块引用>

C:Users ameAnaconda3Libsite-packages~atplotlib-3.0.3-py3.7.egg-info

关注 Hoefling 的评论(下)

我检查了egg-info目录中的SOURCES.txt文件%dir%/~atplotlib-3.0.3-py3.7.egg-info/SOURCES.txt.浏览此文件中的路径列表,并确保列出的所有路径都不包含 ~.然后我将目录 ~atplotlib-3.0.3-py3.7.egg-info 重命名为 atplotlib-3.0.3-py3.7.egg-info(删除了波浪号 ~).
最后运行pip uninstall atplotlib,提示如下:

<块引用>

卸载atplotlib-3.0.3:
将删除:
C:Users ameAnaconda3Libsite-packagesatplotlib-3.0.3-py3.7.egg-infoC:Users ameAnaconda3Libsite-packagesmatplotlib
C:Users ameAnaconda3Libsite-packagespylab.py

继续删除解决了问题(警告消失了,软件包不再出现在软件包列表中.

typing pip freeze I noticed the following warning on top of the list:

WARNING: Could not parse requirement: -atplotlib

So I checked the installed packages using: pip list And, indeed the following is considered a package:

    Package         Version
    --------------- -------
    -atplotlib      3.0.3

I assume I probably had a typo when installing/upgrading matplotlib, which led to the aformentioned "package" being installed.

Unfortunately I am not able to remove it as typing

pip uninstall -atplotlib

is read as a command and returns the following error:no such option: -a. Any suggestion on how to proceed?

EDIT

I found the following folders:

C:Users ameAnaconda3Libsite-packages~atplotlib

C:Users ameAnaconda3Libsite-packages~atplotlib-3.0.3-py3.7.egg-info

Is it safe (and sufficient) to remove them?

解决方案

EDIT: According to this link, provided by Lawrence in his answer

looking for and deleting the incorrectly named folders in your site-package directory should solve the issue.

If this is not sufficient, continue the cleaning as explained below.

Searching for the name of the broken package (without the leading dash) allowed me to find the following two folders:

C:Users ameAnaconda3Libsite-packages~atplotlib

C:Users ameAnaconda3Libsite-packages~atplotlib-3.0.3-py3.7.egg-info

Following Hoefling's comment (below)

I checked the SOURCES.txt file in the egg-info directory %dir%/~atplotlib-3.0.3-py3.7.egg-info/SOURCES.txt. Went through the list of paths in this file and made sure all paths listed did not contained ~. Then I renamed the directory ~atplotlib-3.0.3-py3.7.egg-info into atplotlib-3.0.3-py3.7.egg-info (removed the tilde ~).
Finally, I ran pip uninstall atplotlib, which prompted the following:

Uninstalling atplotlib-3.0.3:
Would remove:
C:Users ameAnaconda3Libsite-packagesatplotlib-3.0.3-py3.7.egg-info C:Users ameAnaconda3Libsite-packagesmatplotlib
C:Users ameAnaconda3Libsite-packagespylab.py

Proceeding with the removal solved the issue (the warning disappeared and the package is not anymore on the package list.

这篇关于pip 如何删除带有前导破折号的错误安装的软件包:“-pkgname"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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