Skip to content

"workon" command has no effect after second call #25

@zeroxia

Description

@zeroxia

my system: windows 10:

> [System.Environment]::OSVersion.Version

Major  Minor  Build  Revision
-----  -----  -----  --------
10     0      19041  0

powershell version: Version : 5.1.19041.1023

I use pyenv-win to install: 3.8.10

And put the "VirtualEnvWrapper.psm1" at: "$mydocuments\WindowsPowerShell\Modules".
Added these to Profile.ps1:

$PowerShellPath = Split-Path $PROFILE.CurrentUserAllHosts
Import-Module $PowerShellPath\Modules\VirtualEnvWrapper.psm1

Restarted powershell, execute mkvirtualenv t1, I can enter (t1) virtualenv.
then execute deactivate, virtualenv is deactivated, all is good.

Then I type workon t1 again, prompt does not have (t1) prefix, and the python command is still the global one, at this point, if I execute deactivate, this is reported as not recognized.

I have to edit the VirtualEnvWrapper.psm1:
In the function function Workon, change this line:

    Import-Module $activate_path

To this:

    & $activate_path

Now everything works, I can workon t1, deactivate, workon t1, all is good.

Just don't know the root cause, I'm completely noob with powershell.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions