{"id":18755918,"url":"https://github.com/pyenv-win/pyenv-win-venv","last_synced_at":"2025-04-05T21:06:20.062Z","repository":{"id":56756480,"uuid":"524635141","full_name":"pyenv-win/pyenv-win-venv","owner":"pyenv-win","description":"A CLI to manage virtual envs with pyenv-win","archived":false,"fork":false,"pushed_at":"2025-01-02T08:36:08.000Z","size":61,"stargazers_count":108,"open_issues_count":14,"forks_count":12,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-03-29T20:04:01.217Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"PowerShell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pyenv-win.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-08-14T10:13:22.000Z","updated_at":"2025-03-25T09:50:18.000Z","dependencies_parsed_at":"2023-11-07T16:26:04.260Z","dependency_job_id":"986774b1-0da1-4b01-94a7-7d1b0408001c","html_url":"https://github.com/pyenv-win/pyenv-win-venv","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyenv-win%2Fpyenv-win-venv","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyenv-win%2Fpyenv-win-venv/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyenv-win%2Fpyenv-win-venv/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyenv-win%2Fpyenv-win-venv/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pyenv-win","download_url":"https://codeload.github.com/pyenv-win/pyenv-win-venv/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247399871,"owners_count":20932876,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-07T17:34:24.747Z","updated_at":"2025-04-05T21:06:20.039Z","avatar_url":"https://github.com/pyenv-win.png","language":"PowerShell","funding_links":["https://ko-fi.com/arzkar"],"categories":["PowerShell"],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003epyenv-win-venv\u003c/h1\u003e\n\n[![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/arzkar)\n\nA CLI to manage virtual envs with pyenv-win\u003cbr\u003e\nTo report issues for the CLI, open an issue at https://github.com/pyenv-win/pyenv-win-venv/issues\n\n# Installation\n\n## Dependencies\n\nThis script depends on the [pyenv-win](https://github.com/pyenv-win/pyenv-win) so it needs to be installed system to run this script.\n\n## Power Shell\n\n```pwsh\nInvoke-WebRequest -UseBasicParsing -Uri \"https://raw.githubusercontent.com/pyenv-win/pyenv-win-venv/main/bin/install-pyenv-win-venv.ps1\" -OutFile \"$HOME\\install-pyenv-win-venv.ps1\";\n\u0026\"$HOME\\install-pyenv-win-venv.ps1\"\n```\n\n**Note:** Skip the [Add System Settings](#add-system-settings) Section\n\n## Git\n\n```pwsh\ngit clone https://github.com/pyenv-win/pyenv-win-venv \"$HOME\\.pyenv-win-venv\"\n```\n\nYou need to add the `\\bin` path to your environment variables using the following steps.\n\n### Add System Settings\n\nAdding the following paths to your USER PATH variable in order to access the pyenv-win-venv command\n\n```pwsh\n[System.Environment]::SetEnvironmentVariable('path', $env:USERPROFILE + \"\\.pyenv-win-venv\\bin;\"  + [System.Environment]::GetEnvironmentVariable('path', \"User\"),\"User\")\n```\n\n- **NOTES**: If you use another path other than `$HOME`, then add the project's `bin` folder to your corresponding USER PATH variable.\n\n- For example, your `pyenv-win-venv` folder located in `D:\\Applications\\pyenv-win-venv`\n\n  ```pwsh\n  [System.Environment]::SetEnvironmentVariable('path', \"D:\\Applications\\pyenv-win-venv\\bin;\" + [System.Environment]::GetEnvironmentVariable('path', \"User\"), \"User\")\n  ```\n\n# Update\n\nAutomatically using `pyenv-venv update self` (Recommended)\n\n## Git (If the CLI was installed using Git)\n\nUsing `git pull`:\n\nGo to `%USERPROFILE%\\.pyenv-win-venv` (which is your installed path) and run `git pull`\n\n## Power Shell (If the CLI was installed using the PowerScript Installation Script)\n\n```pwsh\nInvoke-WebRequest -UseBasicParsing -Uri \"https://raw.githubusercontent.com/pyenv-win/pyenv-win-venv/main/bin/install-pyenv-win-venv.ps1\" -OutFile \"$HOME\\install-pyenv-win-venv.ps1\"; \u0026\"$HOME\\install-pyenv-win-venv.ps1\"\n```\n\n# Uninstallation\n\n## CLI\n\n```\npyenv-venv uninstall self\n```\n\n## Power Shell\n\n```pwsh\nInvoke-WebRequest -UseBasicParsing -Uri \"https://raw.githubusercontent.com/pyenv-win/pyenv-win-venv/main/bin/install-pyenv-win-venv.ps1\" -OutFile \"$HOME\\install-pyenv-win-venv.ps1\";\n\u0026\"$HOME\\install-pyenv-win-venv.ps1\" -Uninstall\n```\n\n# Usage\n\n```\n\u003e pyenv-win-venv\n    pyenv-win-venv v0.6\n    Copyright (c) Arbaaz Laskar \u003carzkar.dev@gmail.com\u003e\n\n    Usage: pyenv-win-venv \u003ccommand\u003e \u003cargs\u003e\n\n    A CLI to manage virtual envs with pyenv-win\n\n    Commands:\n    init                search for .python-version file in the\n                        current directory and activate the env\n    activate            activate an env\n    deactivate          deactivate an env\n    completion          autocomplete script for powershell\n    install             install an env\n    uninstall           uninstall an env\n    uninstall self      uninstall the CLI and its envs\n    list \u003ccommand\u003e      list all installed envs/python versions\n    local               set the given env in .python-version file\n    config              show the app directory\n\n    update self         update the CLI to the latest version\n    which \u003ccommand\u003e     show the full path to an executable\n    help \u003ccommand\u003e      show the CLI/\u003ccommand\u003e menu\n\n    Flags:\n    debug               To show debug log\n```\n\n**Note:** `pyenv-venv` is an alias for `pyenv-win-venv` so either one can be used to call the CLI.\n\n# Example\n\n- To install an env using Python v3.8.5 (should be already installed in the system using `pyenv install 3.8.5`)\n\n```\npyenv-venv install 3.8.5 env_name\n```\n\n- To uninstall an env\n\n```\npyenv-venv uninstall env_name\n```\n\n- To activate an env\n\n```\npyenv-venv activate env_name\n```\n\n- To deactivate an env\n\n```\npyenv-venv deactivate\n```\n\n- To list all installed envs\n\n```\npyenv-venv list envs\n```\n\n- To list all installed python versions\n\n```\npyenv-venv list python\n```\n\n- To set an env to the `.python-version` file\n\n```\npyenv-venv local env_name\n```\n\n- To show the app directory\n\n```\npyenv-venv config\n```\n\n- To update the CLI to the latest version\n\n```\npyenv-venv update self\n```\n\n- To show the full path to the executable\n\n```\npyenv-venv which \u003cexec_name\u003e\n```\n\n- To get help for each command\n\n```\npyenv-venv help install\n```\n\n## PowerShell Completion\n\n- To load completion code into current shell:\n\n```pwsh\npyenv-venv completion | Out-String | Invoke-Expression\n```\n\n- To add completion code directly to the `$PROFILE`\n\n```pwsh\npyenv-venv completion \u003e\u003e $PROFILE\n```\n\n- One-time execution of `pyenv-venv` completion code to the `$PROFILE`\n\n```pwsh\nAdd-Content $PROFILE \"if (Get-Command pyenv-venv -ErrorAction SilentlyContinue) {\n    pyenv-venv completion | Out-String | Invoke-Expression\n}\"\n```\n\n- You can also save the completion script and execute it in the `$PROFILE`, for example:\n\n```pwsh\n# Create completion script\npyenv-venv completion \u003e \"$HOME\\pyenv-venv-completion.ps1\"\n# Add to the `$PROFILE`\nAdd-Content $PROFILE \"$HOME\\pyenv-venv-completion.ps1\"\n```\n\n# Note\n\n## Env automatic activation using `.python-version` file\n\n- You can set the env for a directory using a `.python-version`\n  file and the CLI can automatically activate the env if a shell is\n  opened in that directory.\n\n- `.python-version` file: It should only contain the name of the env and can be created by manually or by using the command: `pyenv-venv local env_name`\n\n- You can manually activate the env if the directory has a `.python-version` file by calling `pyenv-venv init`\n\n- To enable the automatic feature, you need to add `pyenv-venv init` to your the PowerShell Profile.\n  Steps to do this:\n\n  - First check if you already have a powershell profile.\n\n    ```pwsh\n    Test-Path $profile\n    ```\n\n    If its `False`, then you need to create a new profile.\n\n  - Create a new profile using:\n\n    ```pwsh\n    New-Item -path $profile -type file –force\n    ```\n\n    The location to the profile will be shown on the shell.\n\n  - Open the `profile.ps1` file and append the following line.\n\n    ```\n    pyenv-venv init\n    ```\n\n    Save and restart the shell.\n\n**Note:** If you want the CLI to search for a `.python-version` file by traversing from the current working directory to the root till it finds the file, use `pyenv-venv init root`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpyenv-win%2Fpyenv-win-venv","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpyenv-win%2Fpyenv-win-venv","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpyenv-win%2Fpyenv-win-venv/lists"}