我正在尝试卸载虚拟环境中的psycopg2。
当我这样做的时候 'pip uninstall psycopg2'
-我得到一个异常错误:
Uninstalling psycopg2-2.9.1:
Would remove:
/opt/anaconda3/lib/python3.8/site-packages/psycopg2-2.9.1.dist-info/*
/opt/anaconda3/lib/python3.8/site-packages/psycopg2/*
Would not remove (might be manually added):
/opt/anaconda3/lib/python3.8/site-packages/psycopg2/.dylibs/libcom_err.3.0.dylib
/opt/anaconda3/lib/python3.8/site-packages/psycopg2/.dylibs/libcrypto.1.1.dylib
/opt/anaconda3/lib/python3.8/site-packages/psycopg2/.dylibs/libgssapi_krb5.2.2.dylib
/opt/anaconda3/lib/python3.8/site-packages/psycopg2/.dylibs/libk5crypto.3.1.dylib
/opt/anaconda3/lib/python3.8/site-packages/psycopg2/.dylibs/libkrb5.3.3.dylib
/opt/anaconda3/lib/python3.8/site-packages/psycopg2/.dylibs/libkrb5support.1.1.dylib
/opt/anaconda3/lib/python3.8/site-packages/psycopg2/.dylibs/libpq.5.13.dylib
/opt/anaconda3/lib/python3.8/site-packages/psycopg2/.dylibs/libssl.1.1.dylib
Proceed (y/n)? y
ERROR: Exception:
Traceback (most recent call last):
File "/opt/anaconda3/lib/python3.8/shutil.py", line 791, in move
os.rename(src, real_dst)
PermissionError: [Errno 13] Permission denied: '/opt/anaconda3/lib/python3.8/site-packages/psycopg2-2.9.1.dist-info/' -> '/opt/anaconda3/lib/python3.8/site-packages/~.ycopg2-2.9.1.dist-info'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/opt/anaconda3/lib/python3.8/site-packages/pip/_internal/cli/base_command.py", line 189, in _main
status = self.run(options, args)
File "/opt/anaconda3/lib/python3.8/site-packages/pip/_internal/commands/uninstall.py", line 87, in run
uninstall_pathset = req.uninstall(
File "/opt/anaconda3/lib/python3.8/site-packages/pip/_internal/req/req_install.py", line 658, in uninstall
uninstalled_pathset.remove(auto_confirm, verbose)
File "/opt/anaconda3/lib/python3.8/site-packages/pip/_internal/req/req_uninstall.py", line 400, in remove
moved.stash(path)
File "/opt/anaconda3/lib/python3.8/site-packages/pip/_internal/req/req_uninstall.py", line 289, in stash
renames(path, new_path)
File "/opt/anaconda3/lib/python3.8/site-packages/pip/_internal/utils/misc.py", line 347, in renames
shutil.move(old, new)
File "/opt/anaconda3/lib/python3.8/shutil.py", line 803, in move
rmtree(src)
File "/opt/anaconda3/lib/python3.8/shutil.py", line 718, in rmtree
_rmtree_safe_fd(fd, path, onerror)
File "/opt/anaconda3/lib/python3.8/shutil.py", line 675, in _rmtree_safe_fd
onerror(os.unlink, fullname, sys.exc_info())
File "/opt/anaconda3/lib/python3.8/shutil.py", line 673, in _rmtree_safe_fd
os.unlink(entry.name, dir_fd=topfd)
PermissionError: [Errno 13] Permission denied: 'RECORD'
我已经试过了 'sudo pip uninstall psycopg2'
,但它说不存在这样的文件或目录??当我这么做的时候 'pip list'
它在那里?有没有办法卸载它?
3条答案
按热度按时间ugmeyewa1#
我认为您没有删除它的权限,因为您使用的是全局python环境。
所以你应该做你自己的venv和tr
46qrfjad2#
我通过执行“sudo python3-m pip卸载psycopg2”找到了解决方案
mec1mxoz3#
尝试→
或者使用
pip
手动二进制→