Errno 13许可被拒绝。在jupyter笔记本中,UBUNTU

问题描述 投票:0回答:1

我刚刚在Windows中使用'UBUNTU'并在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

这里sungha是我的用户名。

python ubuntu jupyter-notebook
1个回答
3
投票

ls输出

---------- 1 sungha sungha 1418 Sep 14 13:54 Elliptic_main.py

请注意

----------

显示哪些权限设置的部分(see for example in this wiki for further details)在您的情况下,您没有该文件的任何权限,这就是为什么你看到Permission error

尝试

chmod 600 # in case sungha is your username
chmod 666 # otherwise

通过在终端中键入chmod来查看man chmod的联机帮助页,以获取有关两者之间差异的更多详细信息

© www.soinside.com 2019 - 2024. All rights reserved.