Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Activate virtualenv in Ant

Is there a way to activate a newly created virtualenv within an Ant script such that any calls to <exec executable="python"> (site-packages lookups etc) uses the virtualenv and not the global shared path?

I should note that a solution must work on Windows, Linux and Mac.

like image 628
Demian Brecht Avatar asked Jun 12 '26 17:06

Demian Brecht


1 Answers

You can refer directly to the executable in the virtualenv:

<exec executable="<virtual_env_dir>/bin/python">
...

This will automatically use the packages installed in the virtualenv rather than those in the base install.

like image 161
John Keyes Avatar answered Jun 14 '26 08:06

John Keyes



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!