V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
Tidycc
V2EX  ›  Python

有关用 VScode 运行 Python 的一个小问题

  •  1
     
  •   Tidycc · 2018-03-08 09:14:16 +08:00 · 5634 次点击
    这是一个创建于 2212 天前的主题,其中的信息可能已经有所发展或是发生改变。

    个人习惯了使用 VScode,最近配置了 Python 环境时,在 VScode 中有个右键可以直接在终端中运行 Python 文件的功能,可以在终端显示的参数总会多一个 “&”符号,具体如下图:

    不知道这个问题的原因是什么,个人设置的内置终端是 Powershell,以前并未出现过这个原因。 希望用过 VScode 的小伙伴教下

    9 条回复    2018-03-08 22:00:20 +08:00
    jeremaihloo
        1
    jeremaihloo  
       2018-03-08 09:32:03 +08:00
    帮你自动加的换行功能吧,你可以手动加换行符,这个东西应该就不见了

    好像有人说过这个问题,但当时他是 mac iterm2
    Tidycc
        2
    Tidycc  
    OP
       2018-03-08 09:42:26 +08:00
    ![]( )
    图片是这样的,之前不知道怎么在 V2EX 中插入图片,现在补充。
    Tidycc
        3
    Tidycc  
    OP
       2018-03-08 09:55:20 +08:00
    @jeremaihloo 怎么设置手动加换行符啊?查找了下网上也没找到方法
    jeremaihloo
        4
    jeremaihloo  
       2018-03-08 10:33:47 +08:00
    呀,你说的是这个呀,那就和我刚才说的不是一个问题
    你需要看看你 vscode 的 launch 和 task,确定启动的脚本路径和你 Python 路径你没有多加一个&
    你可能需要找 vscode 某个版本的 Release Note,对这个(好像)有解释说明,好像是个 Feature 还是 BugFix
    jeremaihloo
        5
    jeremaihloo  
       2018-03-08 10:42:26 +08:00
    嗯,我找了下 ReleaseNote,是说“-”的问题,不是“&”的问题,你可以再仔细查查其他方面的原因
    abmin521
        6
    abmin521  
       2018-03-08 12:03:38 +08:00 via Android
    是不是 powerahell 的问题
    visitantzj
        7
    visitantzj  
       2018-03-08 12:23:10 +08:00
    “&”语法没问题,在 Powershell 里是明文运行可执行文件,和 linux 下".\executablefile"作用一样
    试试看路径换成反斜杠或者加上”,如果都不行应该是 vscode 本身的问题了
    Koucha
        8
    Koucha  
       2018-03-08 12:56:39 +08:00
    看起来像是 python.exe 的路径是错的
    hanbaobao2005
        9
    hanbaobao2005  
       2018-03-08 22:00:20 +08:00
    这个在 bug: https://github.com/DonJayamanne/pythonVSCode/issues/1098 有涉及。
    你 "python.pythonPath" 变量的值是什么?
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   5335 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 09:26 · PVG 17:26 · LAX 02:26 · JFK 05:26
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.