-1

Iv'e tried using my folder that I made in school in my own pc but I can't seem to start it as I am assuming that the path to my python3.9 in school and in my house is not the same place. I write these 2 commands:

.\env\Scripts\activate

python app.py

And then I get this back: No Python at 'C:\Python\Python39\python.exe

I don't understand much in this field because its new to me. If you need another file or something to help me just tell me and I will add it. Thank you for the help.

sinoroc
  • 18,409
  • 2
  • 39
  • 70
  • In what directory are you when you try to run python? (i.e. are you in C:\Python\Python39). – Ben Nov 15 '22 at 16:53
  • I'm in the D: driver in my folder of my code – נועם ורדי Nov 15 '22 at 16:55
  • 1
    This is not entirely clear from the text of your question, but it seems like you copied your project directory including virtual environment from one machine to another... if it is the case, then you need to know that virtual environments are not meant to be "relocatable", in other words they can not be copied from one machine to another, this use case is not covered. The virtual environment has to be recreated from scratch on each machine. This is easy-ish with [_pip_'s `requirements.txt` files](https://pip.pypa.io/en/stable/reference/requirements-file-format/). – sinoroc Nov 15 '22 at 17:40

2 Answers2

1

First, I would make sure you have Python installed. To do this, at a command prompt, just type 'python' and see if you get a current version.

One 1 of 3 things will happen:

  1. enter image description here

You'll see this...meaning that IT IS installed.

  1. Nothing will happen at all, because you don't have it installed.

  2. Windows will automatically open up the Windows Store so that you can download Python to your computer.

Once it is installed, you need to make sure you have Python set as the language in VS Code. enter image description here You can click there and the menu bar at the top will have a drop-down so that you can select Python.

But it just sounds like you need to have Python installed in the first place. But try those things and if that doesn't work, I'll follow up and help get you going.

  • I do have python and it is set to python in VSCode to Python. I even set a new path from my real files in the C: driver in the environment variables. I checked that the files are installed in here: 'C:\Python\Python39\python.exe'. They are and I don't know what to do next in order to change it. – נועם ורדי Nov 15 '22 at 17:09
  • 1
    It's finally working. I just copied my files of python from another directory to the one it wanted and it works perfectly. Thank you so much. I still don't know how to change the path though but its fine – נועם ורדי Nov 15 '22 at 17:33
0

Use the following methods to choose an interpreter.

  1. Ctrl+Shift+P --> Python:Select Interpreter

    enter image description here

  2. Choose the correct interpreter available

    enter image description here

JialeDu
  • 6,021
  • 2
  • 5
  • 24