提示如何删除前导破折号错误安装的软件包:“-pkgname" [英] pip how to remove incorrectly installed package with a leading dash: "-pkgname"
问题描述
键入pip freeze
我在列表顶部注意到以下警告:
typing pip freeze
I noticed the following warning on top of the list:
警告:无法解析要求:-atplotlib
WARNING: Could not parse requirement: -atplotlib
因此,我使用以下命令检查了已安装的软件包:pip list
而且,实际上以下内容被认为是一个软件包:
So I checked the installed packages using: pip list
And, indeed the following is considered a package:
Package Version
--------------- -------
-atplotlib 3.0.3
我假设我在安装/升级matplotlib时可能遇到了错字,导致安装了上述软件包".
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
作为命令读取,并返回以下错误:no such option: -a
.
对如何进行有任何建议吗?
is read as a command and returns the following error:no such option: -a
.
Any suggestion on how to proceed?
我找到了以下文件夹:
C:\ Users \ name \ Anaconda3 \ Lib \ site-packages \〜atplotlib
C:\Users\name\Anaconda3\Lib\site-packages\~atplotlib
C:\ Users \ name \ Anaconda3 \ Lib \ site-packages \〜atplotlib-3.0.3-py3.7.egg-info
C:\Users\name\Anaconda3\Lib\site-packages\~atplotlib-3.0.3-py3.7.egg-info
删除它们是否安全(足够)?
Is it safe (and sufficient) to remove them?
推荐答案
搜索损坏的程序包的名称(不带前划线)使我能够找到以下两个文件夹:
Searching for the name of the broken package (without the leading dash) allowed me to find the following two folders:
C:\ Users \ name \ Anaconda3 \ Lib \ site-packages \〜atplotlib
C:\Users\name\Anaconda3\Lib\site-packages\~atplotlib
C:\ Users \ name \ Anaconda3 \ Lib \ site-packages \〜atplotlib-3.0.3-py3.7.egg-info
C:\Users\name\Anaconda3\Lib\site-packages\~atplotlib-3.0.3-py3.7.egg-info
跟随Hoefling的评论(如下)
Following Hoefling's comment (below)
我检查了egg-info目录%dir%/~atplotlib-3.0.3-py3.7.egg-info/SOURCES.txt
中的SOURCES.txt
文件.浏览了此文件中的路径列表,并确保列出的所有路径都不包含~
.然后,我将目录~atplotlib-3.0.3-py3.7.egg-info
重命名为atplotlib-3.0.3-py3.7.egg-info
(删除了波浪号~
).
最后,我运行了pip uninstall atplotlib
,它提示了以下内容:
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:
卸载atplotlib-3.0.3:
将删除:
C:\ Users \ name \ Anaconda3 \ Lib \ site-packages \ atplotlib-3.0.3-py3.7.egg-info C:\ Users \ name \ Anaconda3 \ Lib \ site-packages \ matplotlib
C:\ Users \ name \ Anaconda3 \ Lib \ site-packages \ pylab.py
Uninstalling atplotlib-3.0.3:
Would remove:
C:\Users\name\Anaconda3\Lib\site-packages\atplotlib-3.0.3-py3.7.egg-info C:\Users\name\Anaconda3\Lib\site-packages\matplotlib
C:\Users\name\Anaconda3\Lib\site-packages\pylab.py
继续执行删除操作已解决了该问题(警告消失了,并且该软件包不再位于软件包列表中.
Proceeding with the removal solved the issue (the warning disappeared and the package is not anymore on the package list.
这篇关于提示如何删除前导破折号错误安装的软件包:“-pkgname"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!