简体   繁体   English

调试从Jupyter Notebook调用的.py代码

[英]Debuging .py code called from jupyter notebook

I'm really new to python and used to work with matlab and I'm getting really frustrated about the debugging capabilities with python. 我对python真的很陌生,曾经与matlab一起工作,但对python的调试功能感到非常沮丧。

I'm currently trying to do a homework task given in CS231 course ( http://cs231n.github.io/ ), and I'm working with pyCharm (and anaconda). 我目前正在尝试执行CS231课程( http://cs231n.github.io/ )中给出的作业,并且正在使用pyCharm(和anaconda)。 In the homework I have a .ipynb (jupyter notebook file) that guides me through the assignment and in that file I have calls to .py files where I write my own code. 在作业中,我有一个.ipynb(jupyter笔记本文件),该文件可以指导我完成作业,在该文件中,我可以调用.py文件,并在其中编写自己的代码。 I'm trying to figure out a way to debug the code I write. 我正在尝试找出一种调试我编写的代码的方法。 In matlab I could easily set a break point inside the code I wrote and debug it when an external function calls it, while in python, I can't set a breakpoint and debug a code that is called from a jupyter notebook (it just ignores the breakpoint). 在matlab中,我可以轻松地在编写的代码中设置一个断点,并在外部函数调用它时对其进行调试,而在python中,我无法设置一个断点并调试从jupyter笔记本中调用的代码(它只会忽略断点)。

Is there a way of doing so? 有办法吗? And if not what is the best way to debug those kind of stuff? 如果不是,调试这些东西的最佳方法是什么? And less importantly but why is it so difficult to easily debug code in python as opposed to matlab? 不太重要的是,为什么相对于matlab而言,在Python中轻松调试代码如此困难?

Thank you very much! 非常感谢你!

PyCharm Professional 2019允许您运行和调试 Jupyter Notebook单元。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 从 Jupyter Notebook 中的文件“main.py”传输代码 - Transferring code from a file "main.py " in Jupyter Notebook 为什么 Jupyter Notebook 或 Spyder 执行我的 Python 代码比在 windows shell 中调用的 same.py 更快? - Why Jupyter Notebook or Spyder execute way faster my Python code than the same .py called in windows shell? 代码适用于 Jupyter 笔记本,但不如 .py 脚本 - Code works on Jupyter notebook but not as as .py script "删除功能(从 .py 文件导入)在 VS Code Jupyter Notebook 中不起作用" - Delete function (imported from .py file) does not work in VS Code Jupyter Notebook 从 Jupyter Notebook 运行并保存到 .py 文件 - Run from and save to .py file from Jupyter Notebook 来自 jupyter notebook 的漂亮打印 python 代码 - pretty print python code from jupyter notebook 如何从 Jupyter notebook 获取原始代码? - How to get raw code from a Jupyter notebook? 如何将类从 py 文件导入 Jupyter 笔记本? - How to import a class from a py file to a Jupyter notebook? 如何从 Jupyter 实验室笔记本下载 .py 文件? - How to download a .py file from Jupyter lab notebook? 如何从 Jupyter 笔记本上的 * .IPYNB 文件执行 * .PY 文件? - How to execute a * .PY file from a * .IPYNB file on the Jupyter notebook?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM