gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-11-28 21:43:37 25 4
gpt4 key购买 nike

我在 python 中安装了一个包 finsymbols

pip install finsymbols

安装顺利。但是当我尝试使用它时,出现了一个错误,指出权限被拒绝。我试过的代码是

>>>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'

谁能帮我解决这个问题?谢谢

最佳答案

错误的原因是您没有对 finsymbols 包文件夹的写入权限。

授予文件夹写入权限并重试:

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

如果您不想授予对该文件夹的访问权限,请以根用户身份运行您的 python。

关于python - IOError:[Errno 13] 权限被拒绝: '/usr/local/lib/python2.7/dist-packages/finsymbols/SP500.html',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41966109/

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