Search code examples
pythonvisual-studio-2010ptvs

How to run a python script with Python Tools for Visual Studio in a virtualenv?


I don't know how to run the activate.bat in a Python Tools for Visual Studio Project. I have a directory environment in my project with my virtualenv. But, I don't know how I can run ./env/Scripts/activate.bat before the project run my main python script.


Solution

  • I found that if :

    • main.py is set as Startup File,
    • in the Properties of the project -> Debug tab -> Interpreter Path field, I put the path C:...\env\Scripts\python.exe (i.e. the python executable of the virtualenv)

    It works !