Removing Incorrectly Installed Pip Package with Leading Dash (-pkgname)
Problem:
Upon executing "pip freeze," you encounter a warning indicating an unparsable requirement (-atplotlib). "pip list" reveals an installed package called "-atplotlib." Attempts to uninstall it via pip uninstall -atplotlib result in an error (No such option: -a).
Solution:
It is safe and sufficient to manually delete the offending folders (in this case, ~atplotlib and ~atplotlib-3.0.3-py3.7.egg-info) from your site-packages directory.
Technical Explanation:
Pip now renames incorrectly installed packages to prevent importation during the uninstallation process. If uninstallation succeeds, it deletes the renamed folders. However, if uninstallation fails (as in this case), the folders remain. Deleting these folders is safe because they are no longer being used.
Pip's change from copying files to renaming them during uninstallation significantly improves performance, especially for packages with numerous files.
The above is the detailed content of How Do I Remove an Incorrectly Installed Pip Package With a Leading Dash?. For more information, please follow other related articles on the PHP Chinese website!