简体   繁体   English

VsCode 中的“C:\Users\AccountName\AppData\Local\Programs\Python\Python38-32\python.exe”错误中没有 python

[英]no python at "C:\Users\AccountName\AppData\Local\Programs\Python\Python38-32\python.exe" error in VsCode

I was running the Django project without any problems.我正在运行 Django 项目,没有任何问题。 Until I reinstalled Windows and then reinstalled vscode, Now that I am running the Django project: vscode shows the following error:直到我重新安装了 Windows 然后重新安装了 vscode,现在我正在运行 Django 项目: vscode 显示以下错误:

Error: no python at C:\Users\AccountName\AppData\Local\Programs\Python\Python38-32\python.exe 

在此处输入图像描述

This might be occurs if the python directory still in the environment variables path list.如果 python 目录仍在环境变量路径列表中,则可能会发生这种情况。

  1. First remove python entry from the environment variables path if exists .如果存在,首先从环境变量路径中删除 python 条目
  2. Also there will be a chance for virtual environments in your project.您的项目中也将有机会使用虚拟环境。 If the virtual environment is setup in the uninstalled python version then you will get the same error message.如果在卸载的 python 版本中设置了虚拟环境,那么您将收到相同的错误消息。 So, remove the virtual environments which is created under the uninstalled python.因此,删除在卸载的python 下创建的虚拟环境。 It can be done by deleting the virtual environment folder from your system .可以通过从系统中删除虚拟环境文件夹来完成

在此处输入图片说明

Based on the information you provided, it is recommended that you check the Python environment variables.根据您提供的信息,建议您检查 Python 环境变量。

Since the Windows system is reinstalled, the environment variables are restored to the default settings.由于重新安装了Windows系统,环境变量恢复为默认设置。 Therefore, please add Python environment variables:因此,请添加 Python 环境变量:

在此处输入图片说明

Or you can reinstall Python and check the "Add Python 3.8 to PATH " option, which will automatically add Python environment variables.或者您可以重新安装 Python 并选中“将 Python 3.8 添加到 PATH ”选项,这将自动添加 Python 环境变量。

You could also refer to : Python environment variables .您还可以参考: Python 环境变量

It's very simple这很简单

  1. Delete your dbsqite3 file from your project folder从您的项目文件夹中删除您的 dbsqlite3 文件
  2. Open your project in CMD在 CMD 中打开您的项目
  3. install virtual environment pip install virtaualenv安装虚拟环境pip install virtaualenv
  4. virtualenv .虚拟环境。
  5. \\scripts\\activate \\脚本\\激活
  6. python manage.py runserver python manage.py runserver

and play with your code you shared .并使用您共享的代码。

This works for Pycharm, It did to me From your projects folder, delete the 3 folders ie .ide,venv, and the third folder i think.. do not touch the projects or scripts you created.这适用于 Pycharm,它对我有用 从您的项目文件夹中,删除 3 个文件夹,即 .ide、venv,以及我认为的第三个文件夹......不要触摸您创建的项目或脚本。 After wards, go to Pycharm and configure python interpreter again.之后,再次进入Pycharm并配置python解释器。 This will now enable you to run yo scripts now with no prob这将使您现在可以毫无问题地运行 yo 脚本

Edit pyvenv.cfg编辑 pyvenv.cfg

home = C:\Users\UserName\AppData\Local\Programs\Python\Python38-32
include-system-site-packages = false
version = 3.8.3

When I edited this file after checking the file path on my computer, it worked for me.当我在检查计算机上的文件路径后编辑此文件时,它对我有用。

确保在安装 python 之前安装 virtualenv

check wheather django is installed (if your are using django framework).检查是否安装了 django(如果您使用的是 django 框架)。

pip install django pip 安装 django

暂无
暂无

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

相关问题 如何让 VS Code 运行“python”而不是“& C:/Users/[username]/AppData/Local/Programs/Python/Python38/python.exe”? - How do you get VS Code to run “python” instead of “ & C:/Users/[username]/AppData/Local/Programs/Python/Python38/python.exe”? 为什么我得到 (gsutil): "C:\\Users\\user\\AppData\\Local\\Programs\\Python\\Python37\\python.exe": command not found - why am i getting (gsutil): "C:\Users\user\AppData\Local\Programs\Python\Python37\python.exe": command not found 文件“C:\Python38-32\lib\os.py”,第 411 行语法错误 - File “C:\Python38-32\lib\os.py”, line 411 Syntax Error Python:pipenv 错误(ValueError:不是有效的 Python 路径:'C:/Users/LGIT/$USERPROFILE$/Local/Programs/Python2/Python27/Scripts/python.exe') - Python: pipenv Error (ValueError: Not a valid python path: 'C:/Users/LGIT/$USERPROFILE$/Local/Programs/Python2/Python27/Scripts/python.exe') PyCharm Python 解释器错误“'C:\Program Files\Python38\python.exe' 处没有 python - PyCharm Python interpreter error "No python at 'C:\Program Files\Python38\python.exe' 如何将项目重新路由到 PyCharm 中的另一个 Python 版本? (错误:'C:\Users\...\python.exe' 处没有 Python) - How do I reroute a project to another Python version in PyCharm? (Error: No Python at 'C:\Users\…\python.exe') '\\python.exe' 中没有 python - No python at '\python.exe' Pyinstaller WARNING:lib not found: api-ms-win-core-path-l1-1-0.dll dependency of c:\users\ymzym\appdata\local\programs\python\python39-32\python39.dll - Pyinstaller WARNING:lib not found: api-ms-win-core-path-l1-1-0.dll dependency of c:\users\ymzym\appdata\local\programs\python\python39-32\python39.dll Pipenv 错误“'C:\Python39\python.exe' 处没有 Python” - Pipenv error "No Python at 'C:\Python39\python.exe' " python.exe - 系统错误 - python.exe - System Error
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM