gpt4 book ai didi

windows - 直接使用 PTVS 创建 python 发行版

转载 作者:可可西里 更新时间:2023-11-01 10:36:40 24 4
gpt4 key购买 nike

我可以直接使用 PTVS(Visual Studio 的 Python 工具)为我的模块创建“Python 分发版”吗?我在使用命令行但未使用 PTVS 之前完成了此操作。如果是,如何?谢谢!

最佳答案

目前没有。我认为您想投票的功能是 Feature: build package .如果您过去曾使用 py2exe 或其他软件包完成过此操作,那么您可以使用我们的 2.1 版本将其直接连接到 PTVS 中。这将为您提供项目的上下文菜单,让您可以从 IDE 中运行命令。

为此,您需要修改 .pyproj 文件并添加如下内容:

  <PropertyGroup>
<PythonCommands>$(PythonCommands);PythonRunPyLintCommand</PythonCommands>
<PyLintWarningRegex>
<![CDATA[^(?<filename>.+?)\((?<line>\d+),(?<column>\d+)\): warning (?<msg_id>.+?): (?<message>.+?)$]]>
</PyLintWarningRegex>
</PropertyGroup>

<Target Name="PythonRunPyLintCommand"
Label="Run PyLint"
DependsOnTargets="ResolveStartupPath"
Returns="@(Commands)">
<CreatePythonCommandItem Target="pylint.lint"
TargetType="module"
Arguments="&quot;--msg-template={abspath}({line},{column}): warning {msg_id}: {msg}&quot; -r n @(Compile, ' ')"
WorkingDirectory="$(WorkingDirectory)"
ExecuteIn="output"
RequiredPackages="pylint&gt;=1.0.0"
WarningRegex="$(PyLintWarningRegex)">
<Output TaskParameter="Command" ItemName="Commands" />
</CreatePythonCommandItem>
</Target>

此示例是对 PyLint 的处理,但您可以将 TargetType 更改为可执行文件/脚本/代码或 pip 以执行不同的操作。您可以将 ExecuteIn 更改为 console、output 或 repl,以使输出显示在各种不同的位置。

关于windows - 直接使用 PTVS 创建 python 发行版,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22498982/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com