Python Auto Environment Activate
Automatically activate Python environment in terminal when you select an interpreter in VS Code.
Features
- 🔄 Automatic Activation: Automatically activates the selected Python environment in your terminal
- 🐍 Multi-Environment Support:
- Conda environments
- Virtual environments (venv/virtualenv)
- System Python (no activation needed)
- 🖥️ Cross-Platform: Works on macOS, Windows, and Linux
- ⚙️ Highly Configurable: Customize activation behavior to your needs
- 🔌 Seamless Integration: Works with the official VS Code Python extension
Requirements
How It Works
- When you select a Python interpreter via the status bar or command palette
- The extension automatically detects the environment type (Conda/venv/system)
- It sends the appropriate activation command to your active terminal
- Your terminal is now ready to use with the selected environment!
Extension Settings
This extension contributes the following settings:
| Setting |
Type |
Default |
Description |
pythonAutoEnvActivate.enabled |
boolean |
true |
Enable/disable automatic environment activation |
pythonAutoEnvActivate.createNewTerminal |
boolean |
false |
Create a new terminal for activation instead of using the active terminal |
pythonAutoEnvActivate.showNotification |
boolean |
true |
Show a notification when an environment is activated |
Usage
- Install the extension
- Select any Python interpreter using the Python extension's interpreter selector
- The environment will automatically activate in your terminal!
Manual Activation (Optional)
If you ever need to re-activate the current environment, you can use the command:
- Open Command Palette (Ctrl+Shift+P / Cmd+Shift+P)
- Search for "Python: Activate Environment in Current Terminal"
Supported Environment Types
Conda Environments
- Automatically detects Conda, Miniconda, and Anaconda environments
- Uses
conda activate <env-name> command
- Supports base environment and custom named environments
Virtual Environments (venv/virtualenv)
- Detects standard Python virtual environments
- Looks for
activate script (macOS/Linux) or activate.bat/Activate.ps1 (Windows)
- Uses
source <path-to-activate> or equivalent command
System Python
- No activation required
- Shows informational message when system Python is selected
Troubleshooting
Conda Activation Not Working
- Make sure Conda is properly initialized in your shell
- Check that
conda command is available in your terminal PATH
- For Windows users, you may need to enable Conda in PowerShell
Virtual Environment Activation Not Working
- Ensure the virtual environment has an activate script in the expected location
- Check file permissions for the activate script
Terminal Not Activating
- Try reloading the VS Code window
- Check that the Python extension is properly installed and activated
- Look for error messages in the VS Code developer console (Help > Toggle Developer Tools)
Known Issues
- For some shell configurations (like fish, zsh custom themes), activation may require additional setup
- Conda activation in PowerShell may require running
conda init powershell first
Release Notes
0.0.1
- Initial release
- Support for Conda environments
- Support for virtual environments (venv/virtualenv)
- Cross-platform support for macOS, Windows, Linux
- Configurable activation options
Contributing
Contributions are welcome! Please feel free to submit issues or pull requests on GitHub.
License
MIT License
Enjoy! 🚀
| |