Skip to content

Instantly share code, notes, and snippets.

@atrolla
Created January 6, 2019 11:02
Show Gist options
  • Save atrolla/9b8e4db79f1454b4e905d6c11d57a82a to your computer and use it in GitHub Desktop.
Save atrolla/9b8e4db79f1454b4e905d6c11d57a82a to your computer and use it in GitHub Desktop.
Windows Batch to create or update conda virtual env
@ECHO OFF
:: ce batch pour windows s'utilise avec un environment.yml qui sert pour conda et ses dépendences
:: notez qu'il faut specifier le chemin vers le script conda ici
set conda_path=C:\Perso\Dev\Python\anaconda3\Scripts
:: extraction du nom de l'environnement virtuel pour vérifier s'il existe ou pas
set /p yaml_env_name_line=< environment.yml
set env_name=%yaml_env_name_line:~6%
%conda_path%\conda.exe env list | find /i "%env_name%"
if not errorlevel 1 (
:: environnement TROUVE -> update
%conda_path%\conda.exe env update -f environment.yml
) else (
:: environnement PAS TROUVE -> create
%conda_path%\conda.exe env create -f environment.yml
)
name: formation_python
#channels:
# - conda-forge
dependencies:
- scipy
- numpy
- typing
- pip:
- wheelhouse/toolz-0.9.0.tar.gz
# note : for pip, we can directly put tar.gz/whl files here using relative directory or even http link
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment