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.
I usually point Visual Studio to a custom startup.py
script, any other batch files I can then run using:
# startup.py
import os
import main.py # Whatever your main script is
os.system('activate.bat') # Call your batch files.
main.run() # Call whatever you need to from your main script.
In Visual Studio
startup.py
(whatever)
I found that if :
It works !
Python Tools for Visual Studio(PTVS) 2.0 is out now, in it you can add a virtualenv.
Open the Solution Explorer: View > Solution Explorer
Right click on 'Python Environments' and choose 'Add Virtual Environment'
Here is a video showing how to do it.
Full support for Virtual Env is coming in PTVS 2.0 Beta/RTM. See http://pytools.codeplex.com for news/updates. Early support is in PTVS 2.0 Alpha, available now.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With