![]() You might have noticed that just like the "ls" command could string directories with the "/", the "cd" command can as well. Now, if I type "pwd" you'll see that I'm inside the "Downloads" directory. ![]() " we will be moved up one directory, into the "Downloads" directory. " we would be changing directories to the one we're already in, which isn't very helpful. The two dots represent the directory that the current directory is inside, in this case the "Downloads" directory. The single dot represents the current directory, in this case the "Examples" directory. You could type the entire path explicitly like "cd /Users/ModulesUnraveled/Downloads" but depending on how deep you are, that could quickly become obnoxious. So, moving down into folders is pretty easy, but it might not be obvious how to move back up one level. Now, I can type "pwd" to verify that we're inside the "Examples" directory, and I can type "ls -al" to view the files and folders inside the "Examples" directory. I'll type "cd Downloads/Examples" to change directories into the "Examples" directory that is inside the "Downloads" directory. The second way to list files in a directory, is to first move into the directory using the "cd" command (which stands for "change directory", then simply use the "ls" command. We'll use "cd" to move down as well as up the directory structure. I find environment.yml files to be a bit of a pain sometimes (they’re not always cross-platform compatible – see this issue), so this is quite useful as it actually gives me the commands that I ran to create the environment.In this video, we'll use the "cd" command to move into another directory before we list its files. (For reference, the command-line magic gets the content of the history file, searches for all lines starting with # cmd, and then splits the line by spaces and extracts everything from the 3rd group onwards) Users/robin/anaconda3/envs/hotbar/bin/conda install -c conda-forge rasterio Users/robin/anaconda3/envs/hotbar/bin/conda install matplotlib numpy scipy ipython jupyter mahotas statsmodels scikit-image pandas gdal tqdm Specifically, it doesn’t just give you the list of what was installed, uninstalled or upgraded – but it also gives you the commands you ran! If you want, you can extract these commands with a bit of command-line magic:Ĭat ~/anaconda3/envs/hotbar/conda-meta/history | grep '# cmd' | cut -d" " -f3- /Users/robin/anaconda3/bin/conda create -name hotbar python=2.7 # cmd: /Users/robin/anaconda3/envs/hotbar/bin/conda install matplotlib numpy scipy ipython jupyter mahotas statsmodels scikit-image pandas gdal tqdm You don’t want to know why I went searching for this file (it’s a long story involving some stupidity on my part), but it’s got some really useful contents: => 22:41:06 22:46:28 <= One more thing is that I’ve found out that all of this data is stored in the history file in the conda-meta directory of your environment ( CONDA_ROOT/conda-meta for your default environment and CONDA_ROOT/envs/ENV_NAME/conda-meta for any other environment). You can see that the changes for revision 3 are just the inverse of revision 2. For example, if your revision list looks like this: 21:12:34 (rev 1)Īnd you revert to revision 1 by running conda install -revision 1, and then run conda list -revisions again, you’ll get this: 21:13:08 (rev 2) I’ve got a few other hints for you though…įirstly, if you ‘revert’ to a previous revision then you will find that an ‘inverse’ revision is created, simply doing the opposite of what the previous revision did. So, I think that’s pretty awesome – and really handy if you screw things up and want to go back to a previously working environment. ![]() This will ask you to confirm the relevant package uninstallation/installation – and get you back to exactly where you were before! If you want to revert to a previous revision you can simply run conda install -revision N (where N is the revision number). In this output you can see a number of specific versions (or revisions) of this environment (in this case the default conda environment), along with the date/time they were created, and the differences (installed packages shown as +, uninstalled shown as - and upgrades shown as ->). If you run conda list -revisions, you’ll get an output like this: 20:20:37 (rev 10) The best way to explain is by a quick example. However, the other day I came across a wonderful feature that I’d never known about before… revisions! I now use Anaconda as my primary Python distribution – and my company have also adopted it for use on all of their developer machines as well as their servers – so I like to think I’m a relatively knowledgeable user. Robin's Blog Conda revisions: letting you ‘rollback’ to a previous version of your environment June 14, 2016
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |