简体   繁体   English

如何在 PyCharm 中调试外部 python package

[英]How can I debug external python package in PyCharm

I have downloaded python package from the web (eg, github).我已经从 web(例如,github)下载了 python package。

The usage is via CLI, for example:用法是通过 CLI,例如:

python functionality.py opt1 opt2

Since I want to understand what is going on under the hood in functionality.py I want to be able to debug it line by line.因为我想了解functionality.py .py 中的幕后情况,所以我希望能够逐行调试它。 How can I achieve that using PyCharm?如何使用 PyCharm 实现这一目标?

Sorry for not writing a comment, but I don't have the right.很抱歉没有写评论,但我没有权利。

You could use the package in a simple script (import it).您可以在一个简单的脚本中使用 package(导入它)。 Afterwards, press CTRL+LEFT CLICK on the function/class that you have used in order to see the source code.然后,在您使用的函数/类上按 CTRL+LEFT CLICK 以查看源代码。 Now you can put breakpoints my clicking on the space near the line number现在你可以在我点击行号附近的空格处设置断点断点设置 . . The red point indicates that a breakpoint is put.红点表示放置了一个断点。 You can run your script in debug mode using the debugger from the menu up right (second icon) and see what's happening.您可以使用右上角菜单中的调试器(第二个图标)在调试模式下运行脚本并查看发生了什么。 在此处输入图像描述

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

相关问题 我可以同时使用 Python2 和 Python3 在 PyCharm 中调试吗 - Can I use both Python2 and Python3 to debug in PyCharm 如何使用Docker Python解释器在PyCharm中的调试中执行测试? - How can I execute my tests in Debug in PyCharm using a Docker Python Interpreter? 如何在使用 PyCharm 的远程计算机上调试从 Python 调用的 C++ 代码? - How can I debug C++ code called from Python on a remote machines using PyCharm? 如何使用PyCharm从命令行调试python脚本? - How can I debug a python script from command line using PyCharm? 我可以在安装 python package 后调试它吗? - Can I debug a python package after installing it? 如何在Windows上使用Python + Django + PyCharm更快地调试? - How do I debug faster with Python + Django + PyCharm on Windows? 如何在使用 Pycharm + Docker 测试项目的同时在 Python 库包上进行开发? - How can I develop on a Python library package while testing it a project using Pycharm + Docker? 如何配置 PyCharm 以便它自动安装任何缺少的 Python 包? - How can I configure PyCharm so that it automatically installs any missing Python package? 我如何将这个外部库安装到我的pycharm IDE中 - How can I install this external library to my pycharm IDE 如何为我的 PyCharm Python 项目安装 yaml 包? - How do I install the yaml package for my PyCharm Python project?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM