简体   繁体   English

Python 文件不在 VScode 中运行

[英]Python files not running in VScode

I created this the other day and had no errors.前几天我创建了这个并且没有错误。 It ran perfectly fine.它运行得非常好。 All of a sudden I can't run any saved files and when i create new ones python doesn't seem to work anymore.突然之间我无法运行任何保存的文件,当我创建新文件时,python 似乎不再工作了。 This is what it shows me.这就是它向我展示的。 Any suggestions on how to fix this?对于如何解决这个问题,有任何的建议吗? code that doesn't work不起作用的代码

It seems like your shell cannot find the Python interpreter.您的 shell 似乎找不到 Python 解释器。

If you are using bash as your shell, check .bashrc in your home directory.如果您使用 bash 作为 shell,请检查主目录中的 .bashrc。 You can ls -laF to see all the hidden files.您可以ls -laF查看所有隐藏文件。 Make sure you have the correct Python path that looks something like export PYTHONPATH=${PYTHONPATH}:${HOME}/foo确保您有正确的 Python 路径,类似于export PYTHONPATH=${PYTHONPATH}:${HOME}/foo

Open a terminal application.打开一个终端应用程序。

In it, issue the command which python .在其中,发出命令which python If that returns the location of python, check that this location is in your evironment variable PATH .如果返回 python 的位置,请检查该位置是否在您的环境变量PATH中。

If which returns "not found", try which python3 instead.如果which返回“未找到”,请尝试which python3代替。 If that returns a location, change your VScode settings to use python3 instead of python .如果返回一个位置,请将您的 VScode 设置更改为使用python3而不是python

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM