'Syntax error in activate.bat file during setting venv

I`m trying to set up the virtual environment(venv) for python. When I try to activate it with python activate.bat I see the error:

File "C://Project_X/venv_project/venv/Scripts/activate.bat", line 1
    @echo off
            ^
SyntaxError: invalid syntax

I tried:

  • to change the path

  • re-created the venv

  • a lot of search in google

Issue remains. Maybe someone has an idea how to solve it.



Solution 1:[1]

python creates the file activate.bat when you use it to create a virtual environment.

just run the

/Scripts/activate.bat

without python because its for the shell

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Robert Fairbrother