python - Python:在vscode中按shift + enter后无法运行代码
问题描述
我在 conda 环境中的 vscode 中运行 python 3.7。.ipynb
我确实在 jupyter notebook和普通 python之间切换.py
我面临的问题发生在按shift enter
常规.py
文件后。发生的情况是解释器将 a&
作为 python 路径的第一个字符,这导致Synthax Error
.
当我不小心按下shift enter
运行时,.py file
我必须重新启动 vscode 才能让终端再次工作。
此路径由运行.py
文件的终端显示,没有问题。
PS C:\Users\luuk\Desktop\Scripts\Archive\Archive> conda activate base
PS C:\Users\luuk\Desktop\Scripts\Archive\Archive> & C:/Users/luuk/AppData/Local/Continuum/anaconda3/python.exe "c:/Users/luuk/Desktop/Scripts/Archive/Archive/Python/Pipelines/azdl_adb_chunks.py"
这是按下文件后显示shift enter
的内容.py
Python 3.7.4 (default, Aug 9 2019, 18:34:13) [MSC v.1915 64 bit (AMD64)] :: Anaconda, Inc. on win32
Warning:
This Python interpreter is in a conda environment, but the environment has
not been activated. Libraries may fail to load. To activate this environment
Type "help", "copyright", "credits" or "license" for more information.
>>> & C:/Users/luuk/AppData/Local/Continuum/anaconda3/python.exe "c:/Users/luuk/Desktop/Scripts/Archive/Archive/Python/Pipelines/azdl_adb_chunks.py"
File "<stdin>", line 1
& C:/Users/luuk/AppData/Local/Continuum/anaconda3/python.exe "c:/Users/luuk/Desktop/Scripts/Archive/Archive/Python/Pipelines/azdl_adb_chunks.py"
^
SyntaxError: invalid syntax
尚未在堆栈上发现此问题,因此非常欢迎您提出建议!
解决方案
推荐阅读
- asp.net-core - 多个 pod 的数据保护密钥轮换策略是什么?
- python - 缺少一周和前一周和下一周的平均收入
- reactjs - React-bootstrap carousel styles don't applying
- java - 肥皂 UI 动态响应
- java - 使用 NumberFormatter 时无法删除 JFormatedTextfield 中的整个字符串
- r - 使用正则表达式清理电话号码
- xamarin - App MediaFrameReader 总是返回空位图
- powershell - Powershell:我可以使用 Get-WmiObject Win32_NetworkAdapterConfiguration 从非活动网络适配器获取 IP 地址吗?
- php - php - csv 导出添加绝对路径输出
- c - 如何在 system() 中使用 C 代码变量