gpt4 book ai didi

python - 安装 python 模块 IOError : [Errno 13] Permission denied:

转载 作者:太空宇宙 更新时间:2023-11-04 07:06:26 25 4
gpt4 key购买 nike

我尝试通过在终端中键入来使用 pip 安装 python 库 openpyxl:

    pip install openpyxl

但是没有正确执行。它抛出了一个异常:

    Successfully built openpyxl jdcal et-xmlfile
Installing collected packages: jdcal, et-xmlfile, openpyxl
Exception:
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/Library/Python/2.7/site-packages/pip/commands/install.py", line 342, in run
prefix=options.prefix_path,
File "/Library/Python/2.7/site-packages/pip/req/req_set.py", line 784, in install
**kwargs
File "/Library/Python/2.7/site-packages/pip/req/req_install.py", line 851, in install
self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
File "/Library/Python/2.7/site-packages/pip/req/req_install.py", line 1064, in move_wheel_files
isolated=self.isolated,
File "/Library/Python/2.7/site-packages/pip/wheel.py", line 345, in move_wheel_files
clobber(source, lib_dir, True)
File "/Library/Python/2.7/site-packages/pip/wheel.py", line 323, in clobber
shutil.copyfile(srcfile, destfile)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 83, in copyfile
with open(dst, 'wb') as fdst:
IOError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/jdcal.py'

最佳答案

最好的方法可能是使用 pip install <libname> --user

在你的情况下使用 pip install openpyxel --user 的意思

这会为您的用户安装软件包并且是安全的。您也可能有权为用户安装软件包。

您遇到的权限错误是一个常见的问题。可以在这里看到: pip is not able to install packages correctly: Permission denied error在这里 error: could not create '/usr/local/lib/python2.7/dist-packages/virtualenv_support': Permission denied

使用 sudo pip 命令并不像这里解释的那样安全:What are the risks of running 'sudo pip'?

关于python - 安装 python 模块 IOError : [Errno 13] Permission denied:,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43396670/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com