Python Conda Tips

Command Tips for Miniconda, which is the execution environment of Python. The documentation isn't very complete ... or rather, it feels like it's hard to reach, so I'll summarize it.

Official documentation

Command Flow

#Create a virtual environment(something like virtualenv)
conda create -n my_env numpy scipy

#Display a list of virtual environments
conda info -e

#Enable virtual environment
activate my_env # Windows
source activate my_env # Max/Linux

#Additional installation in virtual environment(When specifying the version conda install scipy=0.12.0 etc.)
conda install scikit-learn

#Install with pip for things that can't be obtained with conda(Support by putting pip in the virtual environment)
conda install pip
pip install Flask

#Export the library installed by conda
conda list --export > conda_requirements.txt

#Update installed packages(conda itself is conda update conda)
conda update numpy

#Disable virtual environment
deactivate # Windows
source deactivate # Max/Linux

#Create a virtual environment from a file
conda create -n my_new_env --file conda_requirements.txt

#It seems that conda env export is good to use these days
conda env export > environment.yml
conda env create -f environment.yml

If you are using pyenv, the shell may crash with source activate. This seems to be a phenomenon caused by pyenv activate and conda activate batting, see here for the solution. Specify the activate of conda with the full path.

References

Using the Anaconda Python Distribution Advanced Features of Conda Part 1 Conda FAQ

Recommended Posts

Python Conda Tips
python tips
python tips
Python Tips
Python tips
Python debugging tips
Python click tips
Unexpectedly (?) Python tips
Python conda on cygwin
Python and numpy tips
Python Tips (my memo)
Python PyTorch install tips
[Blender x Python] Blender Python tips (11/100)
Python / Numpy np.newaxis thinking tips
Python
Pin python managed by conda
Receiving standard input tips @ python
[Tips] Handle Athena with Python
[Python + Selenium] Tips for scraping
Google Drive Api Tips (Python)
~ Tips for beginners to Python ③ ~
Tips on Python file input / output
LaTeX, Python tips in master's thesis
[TouchDesigner] Tips for for statements using python
Tips for calling Python from C
Write python list fast vim tips
[VS Code] ~ Tips when using python ~
kafka python
Python basics ⑤
python + lottery 6
Python Summary
Built-in python
Python comprehension
Python technique
Studying python
Python 2.7 Countdown
Python memorandum
Python FlowFishMaster
Python service
Tips to make Python here-documents easier to read
python function ①
Python basics
Python memo
ufo-> python (3)
Python comprehension
Jupyter Tips 4
install python
Python Singleton
Python basics ④
Python Memorandum 2
python memo
Python Jinja2
Python increment
atCoder 173 Python
[Python] function
Python installation
numpy tips
Tips for dealing with binaries in Python
Installing Python 3.4.3.
Try python
Python memo