skip to Main Content

I ran in Terminal of Visual Studio Code:

(.env) PS C:UsersekuulDesktopGreatProjectsRoom reservation systemmainbackend-api> python
No Python at 'C:Program FilesPython310python.exe'
(.env) PS C:UsersekuulDesktopGreatProjectsRoom reservation systemmainbackend-api> deactivate
PS C:UsersekuulDesktopGreatProjectsRoom reservation systemmainbackend-api> python
Python 3.10.5 (tags/v3.10.5:f377153, Jun  6 2022, 16:14:13) [MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>

Why is this happening?

I can’t run python with activated environment. I tried with cmd and PowerShell (in vscode, Win+R) as well but it did not work.
I want to work with virtual environment since all my libraries are there!

2

Answers


  1. Chosen as BEST ANSWER

    How I solved it: Actually, the problem was not in powershell or cmd, they were just trying to find a python executable, which did not exist.

    Solution: Check your environment settings in .env/pyvenv.cfg. Set home to a correct path to your Python executable.

    Here is a picture of what it should look like:

    picture


  2. The following suggestions are for your reference:

    • It looks like your environment variable has C:Program filesPython310python.exe set.

      Please modify it to C:Program filesPython310 ( remove python.exe )

    • Try to activate python interactive window with py in terminal

      enter image description here

    • Use the Python: Start REPL command to open a python interactive window

      Ctrl+Shift+P to open the command palette, then search for and select Python: Start REPL

      enter image description here

      enter image description here

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search