error: could not delete '/usr/local/lib/python3.6/site-packages/pip/_internal/configuration.py': Per

部署运行你感兴趣的模型镜像

brew install python 报错:
error: could not delete ‘/usr/local/lib/python3.6/site-packages/pip/_internal/configuration.py’: Permission denied

cd /usr/local && sudo chown -R $(whoami) bin etc include lib sbin share var Frameworks

您可能感兴趣的与本文相关的镜像

Python3.8

Python3.8

Conda
Python

Python 是一种高级、解释型、通用的编程语言,以其简洁易读的语法而闻名,适用于广泛的应用,包括Web开发、数据分析、人工智能和自动化脚本

pip3 install yangsuite Collecting yangsuite Cache entry deserialization failed, entry ignored Cache entry deserialization failed, entry ignored Downloading https://files.pythonhosted.org/packages/e4/b5/f373f9be17c78b199e46286caba808af6e780f299f2e15fbc429472a8122/yangsuite-2.9.11-py3-none-any.whl (9.5MB) 100% |████████████████████████████████| 9.5MB 251kB/s Requirement already satisfied: python-json-logger>0.1.10 in /home/user/.local/lib/python3.6/site-packages (from yangsuite) Requirement already satisfied: packaging>=19.0 in /home/user/.local/lib/python3.6/site-packages (from yangsuite) Requirement already satisfied: PyGithub<2.0 in /home/user/.local/lib/python3.6/site-packages (from yangsuite) Requirement already satisfied: appdirs<2.0.0,>=1.4.3 in /home/user/.local/lib/python3.6/site-packages (from yangsuite) Requirement already satisfied: django<3 in /home/user/.local/lib/python3.6/site-packages (from yangsuite) Requirement already satisfied: yangsuite-filemanager in /home/user/.local/lib/python3.6/site-packages (from yangsuite) Requirement already satisfied: yangsuite-netconf in /home/user/.local/lib/python3.6/site-packages (from yangsuite) Requirement already satisfied: docutils in /home/user/.local/lib/python3.6/site-packages (from yangsuite) Requirement already satisfied: markupsafe<2.1 in /home/user/.local/lib/python3.6/site-packages (from yangsuite) Requirement already satisfied: yangsuite-yangtree in /home/user/.local/lib/python3.6/site-packages (from yangsuite) Requirement already satisfied: whitenoise<5.0.0,>=4.1.2 in /home/user/.local/lib/python3.6/site-packages (from yangsuite) Requirement already satisfied: python-slugify<5.0.0,>=4.0.0 in /home/user/.local/lib/python3.6/site-packages (from yangsuite) Requirement already satisfied: django-registration<4,>=3 in /home/user/.local/lib/python3.6/site-packages (from yangsuite) Requirement already satisfied: yangsuite-devices in /home/user/.local/lib/python3.6/site-packages (from yangsuite) Requirement already satisfied: beautifulsoup4 in /home/user/.local/lib/python3.6/site-packages (from yangsuite) Requirement already satisfied: wheel in /home/user/.local/lib/python3.6/site-packages (from yangsuite) Requirement already satisfied: setuptools in /home/user/.local/lib/python3.6/site-packages (from yangsuite) Requirement already satisfied: pyparsing!=3.0.5,>=2.0.2 in /home/user/.local/lib/python3.6/site-packages (from packaging>=19.0->yangsuite) Requirement already satisfied: requests>=2.14.0 in /home/user/.local/lib/python3.6/site-packages (from PyGithub<2.0->yangsuite) Requirement already satisfied: deprecated in /home/user/.local/lib/python3.6/site-packages (from PyGithub<2.0->yangsuite) Requirement already satisfied: pyjwt>=2.0 in /home/user/.local/lib/python3.6/site-packages (from PyGithub<2.0->yangsuite) Requirement already satisfied: pynacl>=1.4.0 in /home/user/.local/lib/python3.6/site-packages (from PyGithub<2.0->yangsuite) Requirement already satisfied: sqlparse>=0.2.2 in /home/user/.local/lib/python3.6/site-packages (from django<3->yangsuite) Requirement already satisfied: pytz in /home/user/.local/lib/python3.6/site-packages (from django<3->yangsuite) Requirement already satisfied: gitpython<4.0.0,>=2.1.9 in /home/user/.local/lib/python3.6/site-packages (from yangsuite-filemanager->yangsuite) Requirement already satisfied: paramiko<3.0,>2.5 in /home/user/.local/lib/python3.6/site-packages (from yangsuite-filemanager->yangsuite) Requirement already satisfied: networkx>=2.0 in /home/user/.local/lib/python3.6/site-packages (from yangsuite-filemanager->yangsuite) Requirement already satisfied: scp<1.0 in /home/user/.local/lib/python3.6/site-packages (from yangsuite-filemanager->yangsuite) Requirement already satisfied: lxml<5.0.0,>=4.3.0 in /home/user/.local/lib/python3.6/site-packages (from yangsuite-netconf->yangsuite) Requirement already satisfied: ncclient>=0.6.4 in /home/user/.local/lib/python3.6/site-packages (from yangsuite-netconf->yangsuite) Requirement already satisfied: xeger==0.3.4 in /home/user/.local/lib/python3.6/site-packages (from yangsuite-yangtree->yangsuite) Requirement already satisfied: jinja2>=2.10 in /home/user/.local/lib/python3.6/site-packages (from yangsuite-yangtree->yangsuite) Requirement already satisfied: pyang>1.7.8 in /home/user/.local/lib/python3.6/site-packages (from yangsuite-yangtree->yangsuite) Requirement already satisfied: yamlordereddictloader==0.4.0 in /home/user/.local/lib/python3.6/site-packages (from yangsuite-yangtree->yangsuite) Requirement already satisfied: text-unidecode>=1.3 in /home/user/.local/lib/python3.6/site-packages (from python-slugify<5.0.0,>=4.0.0->yangsuite) Requirement already satisfied: confusable-homoglyphs~=3.0 in /home/user/.local/lib/python3.6/site-packages (from django-registration<4,>=3->yangsuite) Requirement already satisfied: pyOpenSSL>=21.0.0 in /home/user/.local/lib/python3.6/site-packages (from yangsuite-devices->yangsuite) Requirement already satisfied: pexpect<5.0.0,>=4.6.0 in /home/user/.local/lib/python3.6/site-packages (from yangsuite-devices->yangsuite) Requirement already satisfied: netmiko<3.0,>2.4.1 in /home/user/.local/lib/python3.6/site-packages (from yangsuite-devices->yangsuite) Requirement already satisfied: cryptography>=40.0.2 in /home/user/.local/lib/python3.6/site-packages (from yangsuite-devices->yangsuite) Collecting textfsm>=1.1.0 (from yangsuite-devices->yangsuite) Using cached https://files.pythonhosted.org/packages/82/1a/ab772f8479adedad1bdd12dd5c2bf6facf3fad8d04f35b4f4053201d202d/textfsm-2.1.0-py2.py3-none-any.whl Requirement already satisfied: soupsieve>1.2 in /home/user/.local/lib/python3.6/site-packages (from beautifulsoup4->yangsuite) Requirement already satisfied: charset-normalizer~=2.0.0; python_version >= "3" in /home/user/.local/lib/python3.6/site-packages (from requests>=2.14.0->PyGithub<2.0->yangsuite) Requirement already satisfied: idna<4,>=2.5; python_version >= "3" in /home/user/.local/lib/python3.6/site-packages (from requests>=2.14.0->PyGithub<2.0->yangsuite) Requirement already satisfied: certifi>=2017.4.17 in /home/user/.local/lib/python3.6/site-packages (from requests>=2.14.0->PyGithub<2.0->yangsuite) Requirement already satisfied: urllib3<1.27,>=1.21.1 in /home/user/.local/lib/python3.6/site-packages (from requests>=2.14.0->PyGithub<2.0->yangsuite) Requirement already satisfied: wrapt<3,>=1.10 in /home/user/.local/lib/python3.6/site-packages (from deprecated->PyGithub<2.0->yangsuite) Requirement already satisfied: cffi>=1.4.1 in /home/user/.local/lib/python3.6/site-packages (from pynacl>=1.4.0->PyGithub<2.0->yangsuite) Requirement already satisfied: gitdb<5,>=4.0.1 in /home/user/.local/lib/python3.6/site-packages (from gitpython<4.0.0,>=2.1.9->yangsuite-filemanager->yangsuite) Requirement already satisfied: typing-extensions>=3.7.4.0; python_version < "3.8" in /home/user/.local/lib/python3.6/site-packages (from gitpython<4.0.0,>=2.1.9->yangsuite-filemanager->yangsuite) Requirement already satisfied: bcrypt>=3.1.3 in /home/user/.local/lib/python3.6/site-packages (from paramiko<3.0,>2.5->yangsuite-filemanager->yangsuite) Requirement already satisfied: six in /home/user/.local/lib/python3.6/site-packages (from paramiko<3.0,>2.5->yangsuite-filemanager->yangsuite) Requirement already satisfied: decorator<5,>=4.3 in /home/user/.local/lib/python3.6/site-packages (from networkx>=2.0->yangsuite-filemanager->yangsuite) Requirement already satisfied: pyyaml in /home/user/.local/lib/python3.6/site-packages (from yamlordereddictloader==0.4.0->yangsuite-yangtree->yangsuite) Requirement already satisfied: ptyprocess>=0.5 in /home/user/.local/lib/python3.6/site-packages (from pexpect<5.0.0,>=4.6.0->yangsuite-devices->yangsuite) Requirement already satisfied: pyserial in /home/user/.local/lib/python3.6/site-packages (from netmiko<3.0,>2.4.1->yangsuite-devices->yangsuite) Requirement already satisfied: pycparser in /home/user/.local/lib/python3.6/site-packages (from cffi>=1.4.1->pynacl>=1.4.0->PyGithub<2.0->yangsuite) Requirement already satisfied: smmap<6,>=3.0.1 in /home/user/.local/lib/python3.6/site-packages (from gitdb<5,>=4.0.1->gitpython<4.0.0,>=2.1.9->yangsuite-filemanager->yangsuite) Installing collected packages: yangsuite, textfsm Exception: Traceback (most recent call last): File "/usr/lib/python3.6/site-packages/pip/basecommand.py", line 215, in main status = self.run(options, args) File "/usr/lib/python3.6/site-packages/pip/commands/install.py", line 365, in run strip_file_prefix=options.strip_file_prefix, File "/usr/lib/python3.6/site-packages/pip/req/req_set.py", line 789, in install **kwargs File "/usr/lib/python3.6/site-packages/pip/req/req_install.py", line 854, in install strip_file_prefix=strip_file_prefix File "/usr/lib/python3.6/site-packages/pip/req/req_install.py", line 1069, in move_wheel_files strip_file_prefix=strip_file_prefix, File "/usr/lib/python3.6/site-packages/pip/wheel.py", line 345, in move_wheel_files clobber(source, lib_dir, True) File "/usr/lib/python3.6/site-packages/pip/wheel.py", line 316, in clobber ensure_dir(destdir) File "/usr/lib/python3.6/site-packages/pip/utils/__init__.py", line 83, in ensure_dir os.makedirs(path) File "/usr/lib64/python3.6/os.py", line 220, in makedirs mkdir(name, mode) PermissionError: [Errno 13] Permission denied: &#39;/usr/local/lib/python3.6/site-packages/yangsuite&#39;
最新发布
11-29
你遇到的错误: ``` PermissionError: [Errno 13] Permission denied: &#39;/usr/local/lib/python3.6/site-packages/yangsuite&#39; ``` 以及多次出现: ``` Cache entry deserialization failed, entry ignored ``` 说明你在尝试通过 `pip3 install yangsuite` 安装时,**pip 默认试图将包安装到系统级目录 `/usr/local/lib/python3.6/site-packages/`,但当前用户没有写入权限**。 尽管大多数依赖已经满足(already satisfied),但由于 `yangsuite` 本身是新安装包,必须写入该目录,导致失败。 --- ## ✅ 正确解决方案(无需管理员权限) ### ✅ 推荐方案:使用 `--user` 参数安装到用户目录 ```bash pip3 install --user yangsuite ``` ✅ 这会将 `yangsuite` 及其所有组件(包括 `textfsm`)安装到你的家目录中: ``` ~/.local/lib/python3.6/site-packages/yangsuite/ ``` 可执行文件会放在: ``` ~/.local/bin/ ``` > ⚠️ 确保 `~/.local/bin` 在你的 `PATH` 环境变量中! #### 添加 PATH(一次性设置): ```bash echo &#39;export PATH="$HOME/.local/bin:$PATH"&#39; >> ~/.bashrc source ~/.bashrc ``` 验证是否生效: ```bash which yangsuite # 应输出:/home/user/.local/bin/yangsuite ``` --- ### ✅ 替代方案:使用虚拟环境(最佳实践) 隔离项目环境,避免任何冲突。 ```bash # 创建虚拟环境 python3 -m venv ~/venv-yangsuite # 激活环境 source ~/venv-yangsuite/bin/activate # 升级 pip 并安装 pip install -U pip pip install yangsuite ``` ✅ 所有包都只存在于这个环境中,完全独立安全。 启动服务前记得激活环境即可。 --- ### ❌ 错误做法:使用 `sudo pip3 install` 虽然可以绕过权限问题: ```bash sudo pip3 install yangsuite ``` ⚠️ **强烈不推荐!** 原因如下: - 可能破坏系统包管理器(如 apt/yum)维护的 Python 环境 - 存在安全风险 - 后续升级和卸载困难 - 不符合现代 Python 开发规范 --- ### ✅ 清理缓存(解决 "deserialization failed" 警告) 缓存损坏会导致警告。建议清理: ```bash # 方法1:使用 pip 清理(推荐) pip3 cache purge # 如果命令不存在(旧版 pip),手动删除缓存 rm -rf ~/.cache/pip ``` > 缓存路径通常是:`~/.cache/pip` --- ## ✅ 验证安装结果 ### 如果使用了 `--user`: ```bash # 查看是否安装成功 pip3 show yangsuite # 检查命令是否存在 which yangsuite yangsuite --help ``` 你应该看到类似输出: ``` Name: yangsuite Version: 2.9.11 Location: /home/user/.local/lib/python3.6/site-packages ``` --- ## 🧩 补充说明:为什么之前部分包“already satisfied”? 因为 `yangsuite` 的许多依赖(如 `django`, `pygithub`, `paramiko` 等)你之前已经通过 `--user` 或其他方式安装过了,所以 pip 不需要重新下载。 但主包 `yangsuite` 是首次安装,因此必须写入目标目录 → 触发权限错误。 --- ## ✅ 总结:正确命令流程 ```bash # 1. 清理缓存(可选) pip3 cache purge || rm -rf ~/.cache/pip # 2. 使用 --user 安装(推荐) pip3 install --user yangsuite # 3. 确保 ~/.local/bin 在 PATH 中 export PATH="$HOME/.local/bin:$PATH" # 4. 永久添加 PATH echo &#39;export PATH="$HOME/.local/bin:$PATH"&#39; >> ~/.bashrc # 5. 验证安装 source ~/.bashrc pip3 show yangsuite which yangsuite ``` ---
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值