安装python模块IOError:[Errno 13]权限被拒绝: [英] Installing python module IOError: [Errno 13] Permission denied:

查看:898
本文介绍了安装python模块IOError:[Errno 13]权限被拒绝:的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I tried to install the python library openpyxl using pip by typing into the terminal:

    pip install openpyxl

但是执行不正确.它引发了一个异常:

But it was not executed properly. It threw an exception:

    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

Best way is probably to use pip install <libname> --user

根据您的情况使用pip install openpyxel --user

这将为您的用户安装该软件包,这是安全的.同样,您可能有权为用户安装软件包.

This installs the package for your user and that is safe. Also you have probably the right of installing the package for the user.

您遇到的权限错误是一个常见问题.可以在这里看到: pip无法安装软件包正确:权限被拒绝错误 在这里错误:无法创建'/usr/local/lib/python2.7/dist-packages/virtualenv_support':权限被拒绝

The permission error you have encountered is a frequent problem. As can be seen here: pip is not able to install packages correctly: Permission denied error and here error: could not create '/usr/local/lib/python2.7/dist-packages/virtualenv_support': Permission denied

使用sudo pip命令并不安全,如此处所述:运行"sudo pip"有什么风险?

Using the sudo pip command is not considered as safe as explained here: What are the risks of running 'sudo pip'?

这篇关于安装python模块IOError:[Errno 13]权限被拒绝:的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆