如何让 pydoc 命令在 Windows 中工作?

2022-01-23 00:00:00 python command command-line pydoc

问题描述

pydoc 在 Windows 中不起作用.在这篇文章 Pydoc is not working (Windows XP) dave 的最后回答webb 说要创建一个 pydoc.bat 文件,其中包含以下代码:

pydoc does not work in Windows. at this post Pydoc is not working (Windows XP) the last answer by dave webb says to create a pydoc.bat file with this code in it:

@python c:Python27Libpydoc.py %*

创建 pydoc.bat 后,应该将其放置在何处以便 pydoc 命令在命令提示符下工作?

After I create pydoc.bat where should it be placed so the pydoc command works in the command prompt?

PS 将 C:python27Libpydoc.py 添加到系统环境变量中的 Windows 路径不起作用.即使在注销并重新登录后它也不起作用.

PS adding C:python27Libpydoc.py to the Windows path in the system environment variables does not work. Even after logging out and back in it does not work.


解决方案

PS 将 C:python27Libpydoc.py 添加到系统环境变量中的 Windows 路径不起作用.即使在注销并重新登录后它也不起作用.

PS adding C:python27Libpydoc.py to the Windows path in the system environment variables does not work. Even after logging out and back in it does not work.

PATH 环境变量是一个目录 列表,用于搜索给定的可执行文件.所以你应该将 C:python27Lib 添加到你的 PATH 中(不包括 filename).

The PATH environment variable is a list of directories to search for a given executable. So you should be adding C:python27Lib to your PATH (not including the filename).

至于您创建的 pydoc.bat 文件,放置它的一个地方是通常添加到您的 C:python27Scripts 目录PATH 由 python 安装(因为该文件夹包含您可能希望在命令行中可用的其他脚本).

As for the pydoc.bat file you've created, one place to put it would be the C:python27Scripts directory which is usually added to your PATH by the python installation (since that folder contains miscellaneous scripts that you might like available at the command line).

相关文章