&符号“&"在 VSCode 中运行任何 Python 脚本时出现语法错误? [英] Ampersand "&" syntax error running any Python script in VSCode?

查看:39
本文介绍了&符号“&"在 VSCode 中运行任何 Python 脚本时出现语法错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 VSCode 中,我通常使用 Python 扩展并右键单击 .py 脚本并选择在终端中运行 Python 文件"来运行 Python 脚本.在今天之前,这种方法工作正常,但现在我遇到了以下问题...

In VSCode, I typically run a Python Script using the Python extension and right clicking a .py script and selecting "Run Python File in Terminal". Before today this method worked fine, but now I'm experiencing the below issue...

$ & C:/Users/.../Python/Python37-32/python.exe c:/.../test.py
bash: syntax error near unexpected token `&'

现在我无法使用这种方法运行我的 python 脚本.我可以看到错误的原因,我只是不确定 为什么 VSCode 在该符号前面加上前缀,以及它之前是否这样做过.

Now I can't run my python scripts using this method. I can see the cause of the error, I'm just not sure why VSCode is prefixing that ampersand, and whether it was doing that before or not.

我在玩 virtualenv,也许这就是原因,但即使虚拟环境未处于活动状态,我也会遇到此问题.我已经重新启动了 VSCode 和我的电脑,它似乎坏了.

I was playing around with virtualenv, and perhaps this is the cause, but I'm experiencing this issue even when the virtual environment is not active. I've restarted VSCode and my PC, it appears to be broken.

推荐答案

通过将我的 Python 扩展版本降级到以前的版本来解决此问题.似乎最新版本(仅在几个小时前发布)被窃听了(至少对我而言).

Fixed this by downgrading my version of the Python extension to the previous version. It appears as though the latest version (released only hours ago) is bugged (for me at least).

这篇关于&符号“&"在 VSCode 中运行任何 Python 脚本时出现语法错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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