最近使用 pip
安装 Python 包的时候会产生一条 Warning 信息:
WARNING: Ignoring invalid distribution -atplotlib (d:\python\python39\lib\site-p
ackages)
经测试 Matplotlib 此时使用完全正常,这个 Warning 似乎不会产生什么影响。
可以在 Python 安装目录下的 Lib\site-packages\
下面找到 ~atplotlib.libs
和 ~atplotlib-3.7.0.dist-info
两个文件目录,前者里面是几个 .dll
文件,后面的是一些诸如 namespace_packages.txt
、LICENSE
和 INSTALLER
之类的文件。
类似的文件还有一个 ~klearn
,应该是 sklearn
但是没有产生 Warning。
问了 ChatGPT 还有 DeepSeek 之类的 AI,他们也不知道这个 invalid distribution package 是怎么产生的。
pip
进行卸载~atplotlib
pip uninstall ~atplotlib
ERROR: Invalid requirement: '~atplotlib': Expected package name at the start of
dependency specifier
~atplotlib
^
~
pip uninstall \~atplotlib
ERROR: Invalid requirement: '\\~atplotlib': Expected package name at the start
of dependency specifier
\~atplotlib
^
Hint: It looks like a path. File '\~atplotlib' does not exist.
-atplotlib
~\Desktop $ pip uninstall -atplotlib
Usage:
pip uninstall [options] <package> ...
pip uninstall [options] -r <requirements file> ...
no such option: -a
-
~\Desktop $ pip uninstall \-atplotlib
ERROR: Invalid requirement: '\\-atplotlib': Expected package name at the start
of dependency specifier
\-atplotlib
^
Hint: It looks like a path. File '\-atplotlib' does not exist.
这个办法似乎有效果。我以前就是这样解决的:
rm -rf ./Libs/site-packages/\~atplotlib
我还是想知道为什么 Matplotlib 会产生名为 ~atplotlib
的文件夹,还会被 Python 识别为一个invalid distribution package。