pip: Uninstalling Incorrectly Installed Packages with Leading Dashes ("-pkgname")
You may encounter an odd issue after running pip freeze, receiving a warning about an unrecognized requirement, such as "-atplotlib". Inspecting the installed packages via pip list reveals that this string is indeed recognized as a package.
Attempts to remove the package using the command pip uninstall -atplotlib result in an error message indicating an unrecognized option. To resolve this, identify the offending folders:
C:\Users\name\Anaconda3\Lib\site-packages\~atplotlib C:\Users\name\Anaconda3\Lib\site-packages\~atplotlib-3.0.3-py3.7.egg-info
Is it safe and sufficient to remove these folders?
According to official documentation, it is safe to manually delete these folders from the site-packages directory. Pip has an updated uninstall mechanism that renames the folders to un-importable names before deleting them. If the deletion fails, the folders are renamed back.
In the current scenario, it appears that the failure occurred for an unknown reason. Removing the folders is safe and should resolve the issue.
The above is the detailed content of How to Safely Uninstall Incorrectly Installed Packages with Leading Dashes (\'-pkgname\') in Pip?. For more information, please follow other related articles on the PHP Chinese website!