7

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

Red
  • 26,798
  • 7
  • 36
  • 58
Remo
  • 93
  • 1
  • 1
  • 5
  • Probably copy-paste the error into text, instead of / along with the image. – Red Nov 10 '20 at 17:14
  • 1
    error: no python at C:\Users\AccountName\AppData\Local\Programs\Python\Python38-32\python.exe – Remo Nov 10 '20 at 17:16
  • Is your problem solved? – Red Nov 10 '20 at 23:09
  • 3
    Please note that if you reinstalled Windows (and python), you will most probably have to remove your venv and create a new one. The venv is not a standalone python container, but depends on the python which was used to create it. – Niko Föhr Nov 11 '20 at 06:45

9 Answers9

5

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.

4

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

Codemaker2015
  • 12,190
  • 6
  • 97
  • 81
0

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.

Jill Cheng
  • 9,179
  • 1
  • 20
  • 25
0

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.

mosc9575
  • 5,618
  • 2
  • 9
  • 32
0

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

0

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

pip install django

Yasir
  • 11
  • 1
0

If you move your project from one computer to another with different Python version or environment:

  1. python -m venv env => this creates new folder for virtual env
  2. cp -r venv/Lib/site-packages/* env/Lib/site-packages/ => copy the site-packages from the old virtual environment (venv, use your own) to the new virtual env
  3. env/Scripts/activate => activate the new env
  4. You may delete the old virtual environment
Destroy666
  • 892
  • 12
  • 19
0

This can occur if you install node.js in your machine. Just uninstall the python installed by node restart your computer and reinstall python. No need to delete your environment or anything else. Worked for me severally

-1

make sure to install virtualenv befor install python

Zain Alabdeen
  • 479
  • 3
  • 7