[PYTHON] Command line collection for using virtual environment in Anaconda

Introduction

This is SEIYA (@ SeiyaSunapro7th). I have summarized the command lines that are useful when using a virtual environment (conda environment) using Anaconda.

Environment where execution can be confirmed

macOS Catalina ver.10.17.7 conda ver.4.8.5

1. Confirmation of conda

1-1. Confirm that conda is installed and ver.

$ conda info

1-2. Update conda to the latest version.

$ conda update conda

2. Build a virtual environment with Anaconda

2-1. Build a virtual environment

Commands for building a conda environment. Specify the package to be added when building the conda environment. If you do not specify the version, the latest version will be installed.

$ conda create -n Environment name Add package

When installing python3.7 and numpy in ex. conda environment

$ conda create -n environment name python=3.7 numpy

2-2. Install / unintall, update the library

Install the library that conda supports in the built conda environment.

$conda install library name

On the contrary, the command to uninstall.

$conda uninstall library name

Update the specified library.

$conda update library name

3. Start / exit, delete conda environment

3-1. Starting and closing the conda environment

$conda activate environment name
$ conda deactivate

3-2. Delete the conda environment.

$ conda remove -n Environment name –all

4. Search in the environment

4-1. Output existing virtual environment

Outputs all environments (including base environment) in Anaconda.

$ conda info -e

4-2. Output the existing library in the environment

Output the library installed in the specified environment. If you want to specify it, output the information of the working environment.

$ conda list -n Environment name

5. Find the library you want to install, install the non-compliant library

5-1. Check if it supports conda

Output the library corresponding to conda. It also outputs the library and the corresponding python version.

$ conda search (--full-name)Library name

5-2. Install non-conda compatible libraries

If it doesn't support conda, you can install it with conda by doing the following. If there are several libraries, output the library you want to install and decide which one to use.

$ anaconda search -t conda library name

Find out the details of the package you want to install and find the URL used for install.

$anaconda show package name

ex. If you want to install pygame

$ anaconda show CogSci/pygame

Install the package from the specified URL.

$ conda install -c Searched URL Package name

in conclusion

If you install the Python library without checking the dependencies, it may cause a malfunction. (Be careful when using pip) You can keep the execution environment as clean as possible by using the virtual environment.

Recommended Posts

Command line collection for using virtual environment in Anaconda
Creating a virtual environment in an Anaconda environment
Template for creating command line applications in Python
Error running Jupyter Notebook in Anaconda virtual environment
virtual environment in python
Create an Anaconda virtual environment in your project folder
[For beginners] Install the package in the Anaconda environment (Janome)
Use Anaconda in pyenv environment
Build an Anaconda virtual environment
[Anaconda] Activate the virtual environment
Seaborn, matplotlib garbled characters resolved in Windows10, Anaconda virtual environment
Generate technical indicators for system trading in Anaconda environment Try to create technical indicators for Bitcoin using TA-LIB
Try using Spyder included in Anaconda
Command line tool for Chainer ChainerCMD
How about Anaconda for building a machine learning environment in Python?
PATH when using ANACONDA virtual environment with Pycharm (as of Mac 2020/10/03)
[Personal memo] Python virtual environment command memo
Install scrapy in python anaconda environment
Various Anaconda settings in Windows 10 environment
Timestamp acquisition command in Unix environment
install tensorflow in anaconda + python3.5 environment
Tips for using Selenium and Headless Chrome in a CUI environment
Created an environment for Anaconda & Jupyter
Debug settings in virtual environment when using Pipenv with VS Code
Python3.6 environment construction (using Win environment Anaconda)
A story when a directory is buggy with the django-admin start project command in a virtual environment using Pipenv
Building a virtual environment for Mayavi dedicated to Python 3.6, Anaconda, Spyder users
(For myself) Flask_AWS_1 (Install PHP, MySQL, phpMyAdmin, Python in AWS virtual environment)
Unable to import packages installed in virtual environment with Anaconda on Windows 10
I tried using NVDashboard (for those who use GPU in jupyter environment)
Install Django in a pipenv virtual environment
Python development environment for macOS using venv 2016
Using venv in Windows + Docker environment [Python]
CSS environment created in 10 minutes using Django
Let's create a virtual environment for Python
[Python] Create a virtual environment with Anaconda
I created an Anaconda environment using Docker!
Precautions when using for statements in pandas
[Mac] Building a virtual environment for Python
Building scikit-learn in Windows 10 environment using Pycharm
Decompose command arguments in one line in Python
Notes for using python (pydev) in eclipse
I started Node.js in a virtual environment
Introduction of SoftLayer Command Line Interface environment
Personal best practices for putting command line launch Python projects in Docker containers
Call anaconda virtual environment from ubuntu terminal memorandum
Run PIFuHD in Windows + Anaconda + Git Bash environment
For beginners to build an Anaconda environment. (Memo)
Ubuntu18.04.05 Creating a python virtual environment in LTS
Build Python3.5 + matplotlib environment on Ubuntu 12 using Anaconda
Tips for using Realsense SR300 on MacBook in 2020
Building an Anaconda environment for Python with pyenv
Create a virtual environment with conda in Python
Summary of tools used in Command Line vol.8
Try using conda virtual environment with Jupyter Notebook
Summary of tools used in Command Line vol.5
[Memo] Build a virtual environment with Pyenv + anaconda
Try using LINE Notify for the time being
Error when entering virtual environment with workon command
Syntax highlighting on the command line using Pygments
[Node-RED] Execute Python on Anaconda virtual environment from Node-RED [Anaconda] [Python]