问题:使用pip卸载cryptography
xxx@xxx:~/aaa/bbb$ sudo pip uninstall cryptography
Found existing installation: cryptography 3.4.8
Not uninstalling cryptography at /usr/lib/python3/dist-packages, outside environment /usr
Can't uninstall 'cryptography'. No files were found to uninstall.
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
解决:
由于我安装的cryptography版本是3.4.8, 查看版本及信息:
xxx@xxx:~/aaa/bbb$ pip show cryptography
Name: cryptography
Version: 3.4.8
Summary: cryptography is a package which provides cryptographic recipes and primitives to Python developers.
Home-page: https://github.com/pyca/cryptography
Author: The Python Cryptographic Authority and individual contributors
Author-email: cryptography-dev@python.org
License: BSD or Apache License, Version 2.0
Location: /usr/lib/python3/dist-packages
Requires:
Required-by:
所以删除/usr/lib/python3/dist-packages路径下对应的cryptography-3.4.8.egg-info/
xxx@xxx:/usr/lib/python3/dist-packages$ sudo rm -rf cryptography-3.4.8.egg-info/
然后再执行 sudo pip uninstall cryptography 就可以成功删除了
xxx@xxx:~/aaa/bbb$ sudo pip uninstall cryptography
WARNING: Skipping cryptography as it is not installed.
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
xxx@xxx:~/aaa/bbb/tools$ pip show cryptography
WARNING: Package(s) not found: cryptography