如何在 PyCharm 中运行独立文件 [英] How to run standalone files in PyCharm

查看:25
本文介绍了如何在 PyCharm 中运行独立文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 PyCharm 进行小型项目开发.我使用 Pycharm 的智能感知功能.当我开发每一段代码时,我喜欢偶尔运行它来测试它.我在开发时所需要的只是能够运行该文件.但是,当我右键单击并尝试运行一个独立文件时,PyCharm 会尝试变得智能,并向我展示使用单元测试和其他花哨的测试噱头来运行我的代码的选项.我现在不想部署任何测试框架.

I'm doing small time project development using PyCharm. I use Pycharm for its intellisense features. As I develop each piece of code, I like to run it occasionally to test it. All I need at the point of development is to be able to run the file. However, when I right click and try to run a standalone file, PyCharm tries to be intelligent and shows me options to run my code with unit-tests and other fancy testing gimmicks. I don't want to deploy any testing framework at this point.

我想要的是能够按原样运行任何文件.但不知何故,PyCharm 不允许我对每个文件都这样做.

All I want is to be able to run any file as it is. But somehow, PyCharm is not allowing me to do that for every file.

如果有人可以为此提供解决方法,我将不胜感激.我正在使用 Python 273

I will appreciate if someone can provide a workaround for this. I'm using Python 273

推荐答案

您只需在项目视图中的文件的上下文菜单中选择运行"条目:

You can simply choose the 'Run' entry in the context menu for the file in the Project view:

这将完全按照您输入的方式运行文件

This will run the file exactly as if you had entered

蟒蛇

从命令行,在包含文件的目录中.

from the command line, in the directory containing the file.

第一次执行此操作时,还会在工具栏中添加一个条目,您只需单击一下即可运行该文件

The first time you do this an entry is also added to the toolbar, which allows you to run the file with a single click

并提供用于自定义每次运行时自动提供的一系列选项的选项.

and provides options for customizing a range of options supplied automatically each time you run.

这篇关于如何在 PyCharm 中运行独立文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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