我可以打开jupyter笔记本,但我不能在Mac上运行包含python脚本的笔记本

我可以打开jupyter笔记本,但我不能在Mac上运行包含python脚本的笔记本,python,python-3.x,jupyter-notebook,jupyter,Python,Python 3.x,Jupyter Notebook,Jupyter,我已经在python中使用jupyter和Atom一年多了。我目前正在macOS 10.14上使用Python 3.7.2。从终端运行Python没有问题,下面是我在运行sys.PATH后得到的路径: ['', '/Library/Frameworks/Python.framework/Versions/3.7/lib/python37.zip', '/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7', '/Libra

我已经在python中使用jupyter和Atom一年多了。我目前正在macOS 10.14上使用Python 3.7.2。从终端运行Python没有问题,下面是我在运行
sys.PATH
后得到的路径:

['', '/Library/Frameworks/Python.framework/Versions/3.7/lib/python37.zip', '/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7', '/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload', '/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages']
我可以在jupyter中打开一个jupyter笔记本,但由于一些模糊的原因,我无法运行该笔记本,并且在页面右上角有一个红色的
内核错误
,当我单击它时,会显示以下错误消息:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/tornado/web.py", line 1699, in _execute
    result = await result
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/tornado/gen.py", line 736, in run
    yielded = self.gen.throw(*exc_info)  # type: ignore
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/notebook/services/sessions/handlers.py", line 73, in post
    type=mtype))
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/tornado/gen.py", line 729, in run
    value = future.result()
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/tornado/gen.py", line 736, in run
    yielded = self.gen.throw(*exc_info)  # type: ignore
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/notebook/services/sessions/sessionmanager.py", line 79, in create_session
    kernel_id = yield self.start_kernel_for_session(session_id, path, name, type, kernel_name)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/tornado/gen.py", line 729, in run
    value = future.result()
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/tornado/gen.py", line 736, in run
    yielded = self.gen.throw(*exc_info)  # type: ignore
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/notebook/services/sessions/sessionmanager.py", line 92, in start_kernel_for_session
    self.kernel_manager.start_kernel(path=kernel_path, kernel_name=kernel_name)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/tornado/gen.py", line 729, in run
    value = future.result()
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/tornado/gen.py", line 209, in wrapper
    yielded = next(result)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/notebook/services/kernels/kernelmanager.py", line 160, in start_kernel
    super(MappingKernelManager, self).start_kernel(**kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/jupyter_client/multikernelmanager.py", line 110, in start_kernel
    km.start_kernel(**kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/jupyter_client/manager.py", line 259, in start_kernel
    **kw)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/jupyter_client/manager.py", line 204, in _launch_kernel
    return launch_kernel(kernel_cmd, **kw)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/jupyter_client/launcher.py", line 138, in launch_kernel
    proc = Popen(cmd, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/subprocess.py", line 775, in __init__
    restore_signals, start_new_session)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/subprocess.py", line 1522, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
PermissionError: [Errno 13] Permission denied: '/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7'
这是我的路径(在命令:
nano~/.bash\u profile
之后获得)


我已经卸载了我计算机上的所有python安装,包括anaconda版本(python 2.7除外,因为我的mac不接受我删除它)

好的,我卸载了python,并用
自制重新安装了所有东西,它工作了

好的,我卸载了python,并用
自制重新安装了所有东西,它工作了

它说:PermissionError:[Errno 13]权限被拒绝:“/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7”您是否尝试更改该文件夹的权限?感谢您的评论@J.K。我卸载了所有内容,并通过自制软件安装了python3和jupyter。到目前为止,它工作了…它说:PermissionError:[Errno 13]权限被拒绝:“/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7”您是否尝试更改该文件夹的权限?感谢您的评论@J.K。我卸载了所有内容,并通过自制安装了python3和jupyter。到目前为止它是有效的。。。
# Homebrew
export PATH=/usr/local/bin:$PATH

# Setting PATH for Python 3.7
# The original version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.7/bin:${PATH}"
export PATH

# Setting PATH for Python 3.7
# The original version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.7/bin:${PATH}"
export PATH