
The TensorFlow 2.x versions provide a method for printing the TensorFlow version. Print(tf._version_) TensorFlow Newer Versions To print the TensorFlow version in Python, enter: import tensorflow as tf The library has built-in methods for displaying basic information.

#How to know conda python version code
The simplest way to check the TensorFlow version is through a Python IDE or code editor.
#How to know conda python version how to
Follow one of our guides on installing Python 3: How to install Python 3 on CentOS 7, How to install Python 3 on CentOS 8, How to install Python 3 on Ubuntu, How to install Python on Windows. 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.Note: The recommended version is Python 3. (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
