如何在 Visual Studio Code 的当前文件目录中运行 python 交互? [英] How to run python interactive in current file's directory in Visual Studio Code?

查看:74
本文介绍了如何在 Visual Studio Code 的当前文件目录中运行 python 交互?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在VSCode中执行"Run Selection/Line in Python Terminal"命令时,终端当前的工作目录是工作区根目录.运行选择/行时如何将终端的当前目录设置为当前文件的目录?

When executing "Run Selection/Line in Python Terminal" command in VSCode, terminal's current working directory is the workspace root directory. How can we set current directory of terminal to the current file's directory when running the selection/line?

推荐答案

在用户设置"中,使用搜索栏查找python.terminal.executeInFileDir"并将其值设置 (=) 为true"而不是假".

In "User Settings", use the search bar to look for "python.terminal.executeInFileDir" and set (=) its value to "true" instead of "false".

这篇关于如何在 Visual Studio Code 的当前文件目录中运行 python 交互?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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