如何在 Windows 机器上定义 .pdbrc? [英] How can I define .pdbrc on a Windows machine?

查看:31
本文介绍了如何在 Windows 机器上定义 .pdbrc?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在我的 Windows 机器上定义 .pdbrc?

我的.pdbrc文件:

别名 sl s;;l别名 nl n;;l别名 cl c;;l

阅读

点击左上角的高级系统设置"链接.

这会打开系统属性"对话框.在高级"选项卡上,按环境变量..."按钮.

这会打开环境变量..."对话框.在 的用户变量"的顶部,按新建..."按钮.

对于变量名称:"输入HOME",对于变量值:"输入C:\Users\.

如果 HOME 变量已经存在,只需在当前值和新路径之间放置一个分号.当应用程序使用 HOME 变量时,它可能会按顺序搜索内容.如果您希望首先找到您的新路径,请将其放在列表的首位.

点击好的",然后重新启动任何正在运行 pdb 的应用程序(cmd.exe 或其他).确保您的 .pdbrc 文件位于 C:\Users\ 中.当您再次运行 pdb 时,它现在应该会在启动时读取您的 .pdbrc 文件.

How can I define .pdbrc on my Windows machine?

My .pdbrc file:

alias sl s;;l
alias nl n;;l
alias cl c;;l

After reading the answer to this question, I tried putting it in C:\Users\<my_user>. Starting pdb (using pdb.set_trace()), I tried the aliases. They weren't recognized.

I'd like to know how to set a .pdbrc both globally, and for a virtual environment.

解决方案

pdb looks for the HOME system variable which is not defined by default in Windows. You have to define it yourself.

This issue arises because every user in a *nix operating system (Linux, Unix, Darwin, etc.) has a /home directory where they can put run codes like .pdbrc. The path to this directory lives in a system variable (HOME) that applications use to point to a user's personal files. Windows doesn't really have anything like that. The closest analogy to /home on Windows is probably C:\Users\<username>.

Here is how to define a HOME system variable that contains the path C:\Users\<username>. Left click on the startup button and then right click on "Computer" and select "Properties".

On the top left, click the "Advanced system settings" link.

This brings up the "System Properties" dialog. On the "Advanced" tab, press the "Environment variables..." button.

This brings up the "Environment Variables..." dialog. In the top section for "User variables for <username>", press the "New..." button.

For "Variable name:" put "HOME" and for "Variable value:" put C:\Users\<username>.

If a HOME variable already exists, just put a semi-colon between whatever is the current value and the new path. When an application uses the HOME variable, it will likely search the contents sequentially. If you want your new path to be found first, put it first in the list.

Hit "Okay" a bunch and then restart whatever application (cmd.exe or otherwise) is running pdb. Make sure that your .pdbrc file is in C:\Users\<username>. When you run pdb again, it should now read your .pdbrc file on startup.

这篇关于如何在 Windows 机器上定义 .pdbrc?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆