[英]Python | How to fix the error “NotADirectoryError: [Errno 20] Not a directory: '/usr/bin/python3/site-packages'”
I am using macOS Big Sur and I've been having a problem with installing any python packages for a couple of days now.我正在使用 macOS Big Sur 并且几天来一直在安装任何 python 软件包时遇到问题。 This error happens everytime I try to install or uninstall a python package.
每次我尝试安装或卸载 python package 时都会发生此错误。
I have tried using sudo
as well, but the error persists.我也尝试过使用
sudo
,但错误仍然存在。 Another solution that I have tried was to change the PATH variable to add the /usr/local/bin folder before the /usr/bin one, which contains brew's installation of python3, however that didn't help either.我尝试过的另一个解决方案是更改 PATH 变量以在 /usr/bin 之前添加 /usr/local/bin 文件夹,其中包含 brew 的 python3 安装,但这也无济于事。
Do you have any better suggestions?你有更好的建议吗?
You can locate the site-packages directory, by executing from command line:您可以通过从命令行执行来找到 site-packages 目录:
python -c 'import site; print(site.getsitepackages())'
['/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/site-python', '/Library/Python/2.7/site-packages']
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.