I have installed virtualenv and autoenv on Windows 7 using pip install:
pip install virtualenv
pip install autoenv
and added a .env file with contents:
target_folder/.env
source env/bin/activate
I have also setup the same system on Linux Mint 17. When I CD into the target_directory on Linux Mint, autoenv activates. When I CD into the target_directory on Windows 7, nothing happens. Are there any additional steps in setting up autoenv on Windows 7?
On Linux the autoenv
tool replaces the shell's built in cd
function with its own cd
function that enters the environment specified in the .env file.
On Windows unless using Git Bash/msys2/cygwin the cd
function isn't as easily overridden, and autoenv is basically a shell script, so I'd imagine the reason you aren't seeing the same behavior is that the developers haven't fully implemented a batch/PowerShell version that is tested on Windows.
I am looking at using something like autoenv
myself, so once I have discovered any new information I'll come back and update this answer. I do believe there is a PowerShell module available that does something similar, if I run into it again I'll post it here.
If anyone's still looking for something like this for PowerShell, I have a module available on Github or via the PowerShell Gallery.
try ps-autoenv https://www.powershellgallery.com/packages/ps-autoenv/0.4
https://github.com/nickcox/ps-autoenv
PS> Import-Module ps-autoenv
PS> echo "echo 'whoa'" > project/.autoenv
PS> cd project
whoa
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