[英]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.