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

Viewed 43432

I was running the Django project without any problems. Until I reinstalled Windows and then reinstalled vscode! Now that I am running the Django project, vscode shows the following error:

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

enter image description here

7 Answers

This might be occurs if the python directory still in the environment variables path list.

  1. First remove python entry from the environment variables path if exists.
  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. So, remove the virtual environments which is created under the uninstalled python. It can be done by deleting the virtual environment folder from your system.

enter image description here

Edit 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.

Based on the information you provided, it is recommended that you check the Python environment variables.

Since the Windows system is reinstalled, the environment variables are restored to the default settings. Therefore, please add Python environment variables:

enter image description here

Or you can reinstall Python and check the "Add Python 3.8 to PATH" option, which will automatically add Python environment variables.

You could also refer to : Python environment variables.

It's very simple

  1. Delete your dbsqite3 file from your project folder
  2. Open your project in CMD
  3. install virtual environment pip install virtaualenv
  4. virtualenv .
  5. \scripts\activate
  6. 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 i.e. .ide,venv, and the third folder i think.. do not touch the projects or scripts you created. After wards, go to Pycharm and configure python interpreter again. This will now enable you to run yo scripts now with no prob

make sure to install virtualenv befor install python

check wheather django is installed (if your are using django framework).

pip install django

Related