@
jeeyong 按照你的方法试了一下:
setting.json
"code-runner.executorMap": {
"python": "set PYTHONIOENCODING=UTF-8 && C:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python37\\python.exe -u"
}
Constants.py#!/usr/bin/env python3
#coding=utf-8
if __name__=="__main__":
print("Hello World...")
运行结果:
[Running] /usr/bin/env python3 "e:\vscodeWorkSpace\python-web-app\www\
Constants.py"
ϵͳ�Ҳ���ָ����·����
[Done] exited with code=1 in 0.264 seconds
对照的一个 python 文件
Test.py#coding=utf-8
if __name__=="__main__":
print("Hello Word...")
运行结果:
[Running] set PYTHONIOENCODING=UTF-8 && C:\Users\Administrator\AppData\Local\Programs\Python\Python37\python.exe -u "e:\vscodeWorkSpace\python-web-app\www\
Test.py"
Hello Word...
[Done] exited with code=0 in 0.612 seconds
可以看到 /usr/bin/env python3 "e:\vscodeWorkSpace\python-web-app\www\
Constants.py"
应该就是这个造成的,code runner 先读取的这一行,没有直接调用 python.exe 运行
Constants.py 一会我试试 virtualenv 能不能解决这个问题,谢谢!