This page is a translated version of the page Manual:Pywikibot/Windows and the translation is 79% complete.

Python的路径设置

为了更容易运行Python,可执行文件需要在您的PATH中。

要检查Python是否已正确安装,请打开CMD.EXE并运行:

  C:\> python --version

如果找不到Python,请重新安装Python并启用将python.exe放入PATH(环境变量)的选项。

建立快捷方式

如何制作快速运行命令的快捷方式(Windows用户):

如果您在诸如“我的文档”之类的文件夹中安装Pywikibot,重复使用“chdir”命令进入文件夹运行机器人可能会很麻烦。

在Windows上,您可以创建一个快捷方式,它将打开命令框,您可以使用该命令框轻松运行机器人。 只需按照以下步骤创建一个快捷方式:

  1. 右键单击安装Pywikibot的文件夹。
  2. 单击“创建快捷方式”。将创建带箭头键的新快捷方式图标。
  3. 右键单击新快捷方式,然后单击属性。
  4. 在属性窗口中,在cmd.exe中的目标框中键入。
  5. 在“开始”框中输入pywikibot的完整地址。
  6. 单击“确定”。
  7. 单击快捷方式,cmd.exe将打开,并显示完整路径。
    如果按F5刷新窗口(或重新打开快捷方式的属性),您会注意到快捷方式图标已更改。

设置Unicode

The Windows shell (cmd.exe) is less than perfect when it comes to Unicode support. Because Pywikibot is used widely on non-English MediaWiki sites, we support full Unicode output. If you need Unicode support for the language you work on, the best solution is to use ConEmu Windows console instead of the native console (i.e. cmd.exe).

However, if you decide to stick with native console you need to change the font setting in cmd.exe before this works - or else you get a lot of question marks!

Alternatively, Pywikibot also supports transliteration - for instance, Вики is transliterated to Viki on Western European systems. This also works without changing the font.

Because it is impossible to determine the font used, we ask that you explicitly define which option you want to use. If you do not define this, you will get the following warning:

WARNING: Running on Windows and transliteration_target is not set.
Please see https://www.mediawiki.org/wiki/Manual:Pywikibot/Windows

完整的unicode输出(建议)

要获得完整的unicode输出,您需要更改cmd.exe使用的字体并向user-config.py添加一行。

更改字体
  1. Start cmd.exe or any pywikibot script
  2. Click on the icon in the top left corner ("C:\") or right-click on the title bar
  3. Go to 'Properties'
  4. Go to the 'Font' tab
  5. Select any font that has the TT-logo in front - on Windows XP, this is Lucida Console; on newer versions you can also choose Consolas.
  6. Click 'OK'
  7. Choose 'Save settings for all screens with the same title'

您的cmd.exe现在能够输出完整的unicode!

更改user-config.py

在user-config.py中,请添加以下行:

transliteration_target = None

输出中的块

Because the font is unable to display all glyphs, you will occasionally see characters like this: ☐. However, you can still copy the text to visit the page on a wiki by copy-pasting the characters.

如果你想要音译字符,请继续阅读以下章节。

转译支持

如果您希望使用音译字符,可以将以下行添加到user-config.py:

transliteration_target = console_encoding

或者,如果您想要音译回ascii字符,

transliteration_target = 'ascii'

您可以使用任何标准的python编码。

However, the output now is 'Viki' instead of 'Вики'. This means you cannot copy-paste the page title anymore: ru:Viki is *not* ru:Вики!


If you need more help on setting up your Pywikibot visit the #pywikibot IRC channel 連線 or pywikibot@ mailing list.