简体   繁体   English

IOError:[Errno 13]权限被拒绝:'/usr/local/lib/python2.7/dist-packages/finsymbols/SP500.html'

[英]IOError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/finsymbols/SP500.html'

I installed a package finsymbols in python by 我在python中安装了finsymbols软件包

pip install finsymbols

the installation went fine. 安装进行得很好。 But when I tried to work with that, there was an error saying that permission denied. 但是,当我尝试使用它时,出现一个错误,表明权限被拒绝。 The code I have tried is 我试过的代码是

>>>import finsymbols
>>>sp500 = finsymbols.get_sp500_symbols()
    Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/finsymbols/symbols.py", line 8, in get_sp500_symbols
    page_html = wiki_html('List_of_S%26P_500_companies', 'SP500.html')
  File "/usr/local/lib/python2.7/dist-packages/finsymbols/symbol_helper.py", line 94, in wiki_html
    save_file(file_path, wiki_html)
  File "/usr/local/lib/python2.7/dist-packages/finsymbols/symbol_helper.py", line 39, in save_file
    saved_file = open(file_path, "w")
IOError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/finsymbols/SP500.html'

can anyone help me in solving this ? 谁能帮助我解决这个问题? Thanks 谢谢

The cause of the error is that you do not have write access to the finsymbols package folder. 错误的原因是您没有对finsymbols软件包文件夹的写访问权。

Give the folder write access and try again: 授予文件夹写访问权限,然后重试:

sudo chmod a+w /usr/local/lib/python2.7/dist-packages/finsymbols

If you do not want to give access to that folder, run your python as a root user. 如果您不想授予对该文件夹的访问权限,请以root用户身份运行python。

The better approach would be to use virtualenv This would have allowed you to install any package without requiring elevated permissions. 更好的方法是使用virtualenv。这将允许您安装任何软件包,而无需提升的权限。

You can get a quick guide by visiting https://www.dabapps.com/blog/introduction-to-pip-and-virtualenv-python/ 您可以通过访问https://www.dabapps.com/blog/introduction-to-pip-and-virtualenv-python/获得快速指南。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 它显示“[Errno 13]权限被拒绝:&#39;/ usr / lib / python2.7 / did-packages / Jinja2-2.8.egg-info / entry_points.txt&#39;”当试图安装烧瓶时? - It shows “ [Errno 13] Permission denied: '/usr/lib/python2.7/dist-packages/Jinja2-2.8.egg-info/entry_points.txt'” when trying to install flask? 错误:无法创建'/usr/local/lib/python2.7/dist-packages/virtualenv_support':权限被拒绝 - error: could not create '/usr/local/lib/python2.7/dist-packages/virtualenv_support': Permission denied PermissionError: [Errno 13] Permission denied: '/usr/local/lib/python3.8/dist-packages/grpc/__init__.py' - PermissionError: [Errno 13] Permission denied: '/usr/local/lib/python3.8/dist-packages/grpc/__init__.py' OSError:[Errno 2]没有这样的文件或目录:&#39;/usr/local/lib/python2.7/dist-packages/pyduino-0.0.0-py2.7.egg&#39; - OSError: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist-packages/pyduino-0.0.0-py2.7.egg' 如何在appengine app中使用/usr/local/lib/python2.7/dist-packages中的模块 - How to use module from /usr/local/lib/python2.7/dist-packages in appengine app virtualenv中的python3仍使用/usr/lib/python2.7/dist-packages中的库 - python3 in a virtualenv still uses library in /usr/lib/python2.7/dist-packages 如何从/usr/lib/python2.7/dist-packages/中的dir获取源软件包 - How to get source packages from dir in /usr/lib/python2.7/dist-packages/ pip将2.7个软件包安装到/usr/local/lib/python3.2/dist-packages中 - pip installs 2.7 packages into /usr/local/lib/python3.2/dist-packages 安装djangorestframework时出现错误-权限被拒绝:&#39;/ usr / lib / python2.7 / site-packages / djangorestframework-3.6.3.dist-info&#39; - Getting Error while installing djangorestframework - Permission denied: '/usr/lib/python2.7/site-packages/djangorestframework-3.6.3.dist-info' “PermissionError: [Errno 13] Permission denied: &#39;/usr/lib/python3.5/site-packages&#39;” 安装 Django - “PermissionError: [Errno 13] Permission denied: '/usr/lib/python3.5/site-packages'” installing Django
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM