Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python下如何配置Code Runner 可以直接启动调试? #356

Closed
jiazone opened this issue Sep 1, 2018 · 2 comments
Closed

Python下如何配置Code Runner 可以直接启动调试? #356

jiazone opened this issue Sep 1, 2018 · 2 comments

Comments

@jiazone
Copy link

jiazone commented Sep 1, 2018

VS Code 可以在根目录下新建.env文件配置 PYTHONPATH= "xxx",使在项目下任何.py文件通过”启动调试“运行而不会报 No module named xxx 的错误。直接Run Code 则会报此错误。
我想通过配置 .env文件,在文件下使用Run Code 可以直接启动调试。请问该如何设置?

@jiazone
Copy link
Author

jiazone commented Sep 2, 2018

已解决。code-runner 执行 .py 文件的原理即在cmd中执行命令,所以只需要设置利用PYTHONPATH启动.py文件的命令即可。

"code-runner.executorMap": {
        "python":"set PYTHONPATH=%PYTHONPATH%;$workspaceRoot && $pythonPath $fullFileName"
    }

PS:这是在Windows环境下

@jiazone jiazone closed this as completed Sep 2, 2018
@HeWanli
Copy link

HeWanli commented Apr 24, 2019

请教一下,如何配置code Runner 运行虚拟环境

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants