Python

Terms and conditions of use

We have no responsibility or liability for any unintended consequences or damages that the use of the following information may cause. Please use them at your own risk.

Installation: Linux & Mac

Python with "numpy", "matplotlib", "pandas", "netCDF4", and "basemap"

CentOS 7


- Install "pyenv" (Python environmental manager)
yum install gcc zlib-devel bzip2 bzip2-devel readline-devel sqlite sqlite-devel openssl-devel
git clone https://github.com/yyuu/pyenv.git ~/.pyenv

- Add the following lines to the ".bashrc" file
# pyenv
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"

- activate new ".bashrc" file
source .bashrc
pyenv version

- Install Anaconda package (replace x.x.x by appropriate version numbers)
pyenv install --list
pyenv install anaconda3-x.x.x
pyenv versions
pyenv global anaconda3-x.x.x
pyenv rehash
python --version
pyenv versions

- Add NetCDF4 and Basemap modules
conda update conda
conda list
conda install -c conda-forge netcdf4
conda install -c conda-forge basemap

ln -s /root/.pyenv/shims/python /usr/local/bin/python3

Ubuntu 18.04


- Install "pyenv" (Python environmental manager)
sudo apt-get install git gcc make openssl libssl-dev libbz2-dev libreadline-dev libsqlite3-dev
git clone https://github.com/yyuu/pyenv.git /usr/local/pyenv

- Add the following lines to the ".bashrc" file
# pyenv
export PYENV_ROOT="/usr/local/pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"

- activate new ".bashrc" file
source .bashrc
pyenv version

- Install Anaconda package (replace x.x.x by appropriate version numbers)
pyenv install --list
pyenv install anaconda3-x.x.x
pyenv versions
pyenv global anaconda3-x.x.x
pyenv rehash
python --version
pyenv versions

- Add NetCDF4 and Basemap modules
conda update conda
conda list
conda install -c conda-forge netcdf4
conda install -c conda-forge basemap

ln -s /usr/local/pyenv/shims/python3 /usr/local/bin/python3

Mac OS 10.13 (High Sierra)

- Install "Homebrew" (if not yet)
bash
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

- Install "pyenv" (Python environmental manager)
brew install pyenv
pyenv --version

- Install Anaconda package (replace x.x.x by appropriate version numbers)
pyenv install -l | grep anaconda
pyenv install anaconda3-x.x.x
pyenv versions
pyenv global anaconda3-x.x.x
pyenv versions

- add path to ".tcshrc" file
# Python
set path = ( $HOME/.pyenv/versions/anaconda3-5.3.1/bin $path )

- activate new ".tcshrc" file
source .tcshrc
pyenv version

- Add NetCDF4 and Basemap modules
conda update conda
conda list
conda install -c conda-forge netcdf4
conda install -c conda-forge basemap

- add useful modules for the spectral analysis
conda --version
conda config --add channels conda-forge
conda install spectrum  # Spectral analysis module
conda install mtspec    # Multitaper module

#brew install python3
#which python3
#which pip3
#python3 --version
#pip3 install numpy
#pip3 install scipy
#pip3 install matplotlib
#pip3 install pandas