问题标签 [ptvs]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
2327 浏览

python - Pre- and post-build steps in Python Tools For Visual Studio

I'm trying to switch over from Aptana to PTVS but I'm stymied by an inability to configure the build process. I'd like to add a pre-build step that runs some tests and a post-build step that runs a zip packager / deployment script -- however I'm totally unable to figure out how to add these to PTVS.

In a C# project (for example) I could right click on the project file to get a configuration page which allows editing pre and post build targets. In PVTS that configuration page doesn't exist. My efforts to tweak the .pyproj file by hand have also be unsuccessful. I added a target tag (the way you would in, eg, c#) and was told that the element 'target' did not recognize the attribute 'name' - even though that's how it's specified in all the MS build configs I've ever seen elsewhere.

Is this possible? If so, how can I set it up?

0 投票
1 回答
238 浏览

python - .ptvs 可以安全地被 git 忽略吗?

我正在使用 Visual Studio 2013 和 Visual Studio 的 Python 工具。

在设置项目时,我已经开始添加到标准 VS .gitignore,因为它不包括工具。我的环境文件夹中有一个标有 .ptvs 的子目录。目前它似乎只有登录。

是否有任何重要的事情最终会在那里结束的风险?这方面缺乏文件。

提前致谢。

0 投票
1 回答
245 浏览

python - Visual Studio 2012 替代 Python 内置 IDLE 交互方式

如果输出了太多内容,Python 的内置 IDLE 似乎会降低性能。Visual Studio for python 中是否有类似的交互式控制台?

0 投票
1 回答
1433 浏览

python - Install NLTK with IronPyton for VS2012

I am trying to install the NLTK with IronPython in VS2012. But when I tried to import the NLTK.book, i got the following error. The NLTK.book is the accompanying data for the book.

I am wondering how to change the IronPath's search path.

0 投票
1 回答
398 浏览

python - PTVS:单元测试源路径

使用 Visual Studio 的 Python 工具,我创建了一个“来自现有源的项目”。我可以运行它的主应用程序文件,但是每个单元测试(自动发现!)都无法启动:

我的 python 源代码位于一个名为“src”的文件夹中,它不是一个包。在这种情况下,我正在寻找一种配置“源”路径的方法。

总结:

如何配置用于运行单元测试的源路径?

0 投票
1 回答
131 浏览

python - 需要有关 PTVS 和 python 语法的帮助

我将 python 用于 Visual Studio 2012 (PTVS2012)。到目前为止,我只知道 C#,而我刚刚开始学习 Python。我有几个问题

  1. 好的,据我所知,在 C# 中,您只需创建任何类型的方法,例如整数,后跟静态 void Main() 等参数。在 python 中,我现在知道的唯一方法是 def Main() 但我相信我会学习如何编写更多方法。在 C# 中,大括号围绕方法内的代码块。python 是否也需要大括号,因为在 PTVS 中,每当我尝试将大括号放入方法中时,它都会给我这个“预期的缩进块”。例如,下面的代码示例给了我这个错误。基本上我是否需要牙套?

    定义主():{

    }

  2. 如何在 PTVS 中缩进?就像您在 PTVS 中使用 c# 一样,它会自动缩进,它只会使代码更易于查看和理解

  3. 猜猜这是第 2 点的后续,在我现在的 Python 教程中,我正在学习如何执行我已经从 C# 知道的循环。所以例如

    a = 0

    /li>

在 C# 中,您会使用大括号将要在循环中执行的代码插入并缩进吗?python 在 PTVS 中是否还需要大括号和缩进?

0 投票
1 回答
1094 浏览

python - PTVS + Django:为什么我不能导入 python 库

我正在关注此处的教程:http: //www.windowsazure.com/en-us/documentation/articles/cloud-services-web-sites-python-django-app-with-ptvs/

我已经在我的系统上安装了 django。按照本教程中的说明进行操作后,我注意到它似乎再次安装了 django,但这次是在我的项目文件夹(myproject/env/Lib/site-packages)下。为什么是这样?

我遇到的另一个问题是,如果我尝试使用 Visual Studio 编辑器导入某些库,则无法找到导入。但是,如果在“交互”窗口中执行此操作,它会识别导入。此外,如果创建一个独立的 python(不是 django)项目,我可以很好地导入库。关于为什么会发生这种情况以及如何解决的任何想法?

0 投票
2 回答
657 浏览

python - PTVS 未检测到已安装的 VS2010

我想为 Visual Studio 10 安装 PTVS。每次我运行名为“PTVS 2.0 VS 2010”的 msi 包时,它都会显示一个错误,我必须先安装 VS2010,但我已经安装了 VS2010 express。

我在互联网上查看了一些解决方案,但它对我不起作用,例如我在注册表中添加了 InstallDir 但仍然出现该错误。

0 投票
5 回答
3455 浏览

visual-studio - Visual Studio Express 的 IDE 扩展

只是一个关于 MS Visual Studio Express 版本的快速问题。是否可以安装 Jetbrains ReSharper 或 Python Tools for VS 等扩展并使其与 Visual Studio 的快速版本一起使用?

0 投票
2 回答
1859 浏览

python - PTVS 不会命中 Flask-RESTful 类方法中的断点

我正在使用 Visual Studio 的 Python 工具,并且我已经建立了一个带有虚拟环境的项目并在那里安装了 Flask-RESTful。

然后,我只是复制了他们的 hello world 示例

一切正常,如果我在开始之前执行的行上放置断点,app.run(debug=True)它们就会被击中(F10 和 F11 工作得很好,并且局部变量按预期更新)

但是,我很想调试处理请求时会发生什么,但是如果我向TodoorTodoList类的方法添加断点,它们永远不会被命中。我添加了代码(如print('here'))以查看它们是否正在被处理并且它们是......而且,它们正在返回我从浏览器打开时所期望的内容。

我在设置中缺少什么吗?

谢谢!

更新:我发现如果我将 VS 附加到运行我的代码的 python.exe 进程,我可以调试这些方法......所以我想现在的问题是:我可以强制 VS 附加到进程一旦像使用常规 .NET 应用程序一样启动它?