System Python
You can check the absolute paths and versions of python and pip to get a clear overview:
$ which -a python
/opt/miniconda/bin/python
/usr/local/bin/python
/usr/bin/python
$ which -a pip
/opt/miniconda/bin/pip
/usr/local/bin/pip
Then you can check the versions with:
$ /usr/bin/python --version
Python 2.7.10
$ /usr/local/bin/pip --version
pip 18.1 from /usr/local/lib/python2.7/site-packages/pip (python 2.7)
You can list the installed packages with:
$ /usr/local/bin/pip freeze
protobuf==3.6.1
pycairo==1.18.0
six==1.11.0
Conda
Nevertheless I recommend you to check Anaconda or, even better, miniconda (see the differences). It helps you to install and manage different environments with different Python and package versions. After the installation you do usually:
$ conda create -n env_name python=3.7 -y
$ source activate env_name
$ conda install scikit-learn pandas
Paths:
$ which python
/opt/miniconda/envs/env_name/bin/python
$ which pip
/opt/miniconda/envs/env_name/bin/pip
Versions:
$ python --version
Python 3.7.2
$ pip --version
pip 18.1 from /opt/miniconda/envs/env_name/lib/python3.7/site-packages/pip
Installed packages:
$ pip freeze
certifi==2018.11.29
mkl-fft==1.0.10
mkl-random==1.0.2
numpy==1.15.4
pandas==0.24.0
python-dateutil==2.7.5
pytz==2018.9
scikit-learn==0.20.2
scipy==1.2.0
six==1.12.0
Or the whole conda environment env_name
:
$ conda env export
name: env_name
channels:
- defaults
dependencies:
- blas=1.0=mkl
- ca-certificates=2018.12.5=0
- certifi=2018.11.29=py37_0
- intel-openmp=2019.1=144
- libcxx=4.0.1=hcfea43d_1
- libcxxabi=4.0.1=hcfea43d_1
- libedit=3.1.20181209=hb402a30_0
- libffi=3.2.1=h475c297_4
- libgfortran=3.0.1=h93005f0_2
- mkl=2019.1=144
- mkl_fft=1.0.10=py37h5e564d8_0
- mkl_random=1.0.2=py37h27c97d8_0
- ncurses=6.1=h0a44026_1
- numpy=1.15.4=py37hacdab7b_0
- numpy-base=1.15.4=py37h6575580_0
- openssl=1.1.1a=h1de35cc_0
- pandas=0.24.0=py37h0a44026_0
- pip=18.1=py37_0
- python=3.7.2=haf84260_0
- python-dateutil=2.7.5=py37_0
- pytz=2018.9=py37_0
- readline=7.0=h1de35cc_5
- scikit-learn=0.20.2=py37h27c97d8_0
- scipy=1.2.0=py37h1410ff5_0
- setuptools=40.6.3=py37_0
- six=1.12.0=py37_0
- sqlite=3.26.0=ha441bb4_0
- tk=8.6.8=ha441bb4_0
- wheel=0.32.3=py37_0
- xz=5.2.4=h1de35cc_4
- zlib=1.2.11=h1de35cc_3
prefix: /opt/miniconda/envs/env_name