![](/img/trans.png)
[英]PermissionError: [Errno 13] Permission denied in python jupyter notebook
[英]Errno 13 Permission denied. in jupyter notebook, UBUNTU
我新使用了“ UBUNTU in windows”,並在UBUNTU中打開了jupyter筆記本,制作了新的python3文件,並嘗試加載名為“ Elliptic_main.py”的文件。 但是,以下代碼
%load Elliptic_main.py
給出錯誤信息
---------------------------------------------------------------------------
PermissionError Traceback (most recent call last)
<ipython-input-1-69cbacf526f9> in <module>()
----> 1 get_ipython().run_line_magic('load', 'Elliptic_main.py')
~/.local/lib/python3.6/site-packages/IPython/core/interactiveshell.py in run_line_magic(self, magic_name, line, _stack_depth)
2129 kwargs['local_ns'] = sys._getframe(stack_depth).f_locals
2130 with self.builtin_trap:
-> 2131 result = fn(*args,**kwargs)
2132 return result
2133
<decorator-gen-47> in load(self, arg_s)
~/.local/lib/python3.6/site-packages/IPython/core/magic.py in <lambda>(f, *a, **k)
185 # but it's overkill for just that one bit of state.
186 def magic_deco(arg):
--> 187 call = lambda f, *a, **k: f(*a, **k)
188
189 if callable(arg):
~/.local/lib/python3.6/site-packages/IPython/core/magics/code.py in load(self, arg_s)
333 search_ns = 'n' in opts
334
--> 335 contents = self.shell.find_user_code(args, search_ns=search_ns)
336
337 if 's' in opts:
~/.local/lib/python3.6/site-packages/IPython/core/interactiveshell.py in find_user_code(self, target, raw, py_only, skip_encoding_cookie, search_ns)
3263 if os.path.isfile(tgt): # Read file
3264 try :
-> 3265 return openpy.read_py_file(tgt, skip_encoding_cookie=skip_encoding_cookie)
3266 except UnicodeDecodeError :
3267 if not py_only :
~/.local/lib/python3.6/site-packages/IPython/utils/openpy.py in read_py_file(filename, skip_encoding_cookie)
74 A unicode string containing the contents of the file.
75 """
---> 76 with open(filename) as f: # the open function defined in this module.
77 if skip_encoding_cookie:
78 return "".join(strip_encoding_cookie(f))
~/anaconda3/lib/python3.6/tokenize.py in open(filename)
450 detect_encoding().
451 """
--> 452 buffer = _builtin_open(filename, 'rb')
453 try:
454 encoding, lines = detect_encoding(buffer.readline)
PermissionError: [Errno 13] Permission denied: 'Elliptic_main.py'
我認為這是UBUNTU的問題,但不確定。 有人有同樣的問題嗎? 謝謝你的幫助
打字
ls -l Elliptic_main.py
給出以下消息:
---------- 1 sungha sungha 1418 Sep 14 13:54 Elliptic_main.py
這是我的用戶名。
從ls
輸出
---------- 1 sungha sungha 1418 Sep 14 13:54 Elliptic_main.py
注意
----------
顯示設置了哪些權限的部分( 有關更多詳細信息,請參見此Wiki中的示例 )在您的情況下,您對該文件沒有任何權限,這就是為什么您看到Permission error
嘗試
chmod 600 # in case sungha is your username
chmod 666 # otherwise
通過在終端中鍵入man chmod
來檢查chmod
的man chmod
頁,以獲取有關兩者之間的區別的更多詳細信息
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.