Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

autoenv not working on windows 7

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?

like image 670
Ajax Avatar asked Jul 23 '15 05:07

Ajax


3 Answers

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.

like image 159
dragon788 Avatar answered Nov 20 '22 19:11

dragon788


If anyone's still looking for something like this for PowerShell, I have a module available on Github or via the PowerShell Gallery.

like image 2
Nick Cox Avatar answered Nov 20 '22 20:11

Nick Cox


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

like image 2
autolife autolife Avatar answered Nov 20 '22 19:11

autolife autolife