[英]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.