[PYTHON] Activate Anaconda's virtual environment with PowerShell

environment

problem

Addressed an issue where PowerShell could not activate the conda virtual environment Attempts to activate but not actually done, as shown below

$ conda info -e
# conda environments:
#
py2                      C:\Users\USERNAME\AppData\Local\Continuum\Anaconda3\envs\py2
root                  *  C:\Users\USERNAME\AppData\Local\Continuum\Anaconda3

#Currently root

$ activate py2  #I want to change to py2

$ conda info -e
# conda environments:
#
py2                      C:\Users\USERNAME\AppData\Local\Continuum\Anaconda3\envs\py2
root                  *  C:\Users\USERNAME\AppData\Local\Continuum\Anaconda3

#Stay root!

Workaround

Method (1)

We received a comment from @lambdalisue. You can activate it with the following command.

$ conda install -n root -c pscondaenvs pscondaenvs

Method (2)

It was in Powershell activate and deactivate # 626

Download the activate / deactivate command for PowerShell from Liquidmantis / PSCondaEnvs Copy the file to the folder where activate.bat/deactivate.bat is located

$ git clone https://github.com/Liquidmantis/PSCondaEnvs
$ cd PSCondaEnvs
$ cp activate.ps1 ~\Appdata\Local\Continuum\Anaconda3\Scripts\.
$ cp deactivate.ps1 ~\Appdata\Local\Continuum\Anaconda3\Scripts\.

Verification

$ activate py2

Activating environment "py2..."

$ conda info -e
# conda environments:
#
py2                   *  C:\Users\USERNAME\AppData\Local\Continuum\Anaconda3\envs\py2
root                     C:\Users\USERNAME\AppData\Local\Continuum\Anaconda3

#I was able to activate!

Recommended Posts

Activate Anaconda's virtual environment with PowerShell
Virtual environment with Python 3.6
venv environment with windows powershell
[Anaconda] Activate the virtual environment
Switch virtual environment with jupyter
Build python virtual environment with virtualenv
Create a virtual environment with Python!
Building a virtual environment with Python 3
[Python] Create a virtual environment with Anaconda
Building a Python 3.6 environment with Windows + PowerShell
Create a virtual environment with Python_Mac version
Automatically switch virtual environment with conda + direnv
Build a python virtual environment with pyenv
Beginner virtual environment
Start Django in a virtual environment with Pipenv
Python (Windows 10) Virtual Environment / Package with VS Code
Create a virtual environment with conda in Python
Try using conda virtual environment with Jupyter Notebook
[Memo] Build a virtual environment with Pyenv + anaconda
Error when entering virtual environment with workon command
Build a virtual environment with pyenv and venv
Work in a virtual environment with Python virtualenv.
Flow of creating a virtual environment with Anaconda
From Python environment construction to virtual environment construction with anaconda
Use anaconda virtual environment with Zsh (problem fix)
Virtual environment construction with Docker + Flask (Python) + Jupyter notebook
Build a python virtual environment with virtualenv and virtualenvwrapper
Create a virtual environment with Anaconda installed via Pyenv
python virtual environment Pipenv
code-server Online environment (2) Create a virtual network with Boto3
virtual environment in python
Build a python virtual environment with virtualenv and virtualenvwrapper
Python environment with docker-compose
Notes on creating a virtual environment with Anaconda Navigator
PyTorch introduction (virtual environment)
Ssh to virtual environment with remote development of vscode
Build a Django environment for Win10 (with virtual space)
Reflect the virtual environment created with Miniconda in Jupyter notebook
I want to use a virtual environment with jupyter notebook!
I just built a virtual environment with AWS lambda layer
Building a virtual environment with pyenv-virtualenv/Python (installation, environment settings, packages) Mac environment
Easy tox environment with Jenkins
Create an environment with virtualenv
Minimal website environment with django
Install Python environment with Anaconda
Manage python environment with virtualenv
Build an Anaconda virtual environment
Build python3 environment with ubuntu 16.04
ML environment construction with Miniconda
Prepare python3 environment with Docker
Build python environment with direnv
Building a Python virtual environment
venv: Python virtual environment management
python standard virtual environment venv
Building a Python virtual environment
[PowerShell] Morphological analysis with SudachiPy
Set environment variables with lambda-uploader
Web application created with Python + Flask (using VScode) # 1-Virtual environment construction-
PATH when using ANACONDA virtual environment with Pycharm (as of Mac 2020/10/03)
[PyCaret] Installation method Failed with pip-> Solved by creating virtual environment!
Debug settings in virtual environment when using Pipenv with VS Code