This is an old revision of the document!
Python
General Information
Administration of Python environments.
Checklist
- Distro(s): Enterprise Linux 6/7
Python Versions
OS | System Package | EPEL | Software Collections |
---|---|---|---|
CentOS 6.x | 2.6.6 | 3.4 | 2.7, 3.3, 3.4 |
CentOS 7.x | 2.7 | 3.4 | 2.7, 3.3, 3.4, 3.5 |
- To avoid breaking system packages(ie yum uses python), let system packaged python versions stay maintained by the official repos.
- Use EPEL/software collections along with something such as virtualenv to maintain development environments.
Python3 Install: EPEL
To install python 3.4 from the EPEL
yum install python34
Python3 Install: Software Collections
Software Collections allow for environments such as newer Python versions to be installed via repos and not conflict with the default system version.
See Software Collections Instructions
Pip
Pip is a Python package management tool to install modules.
Install Pip
wget https://bootstrap.pypa.io/get-pip.py python get-pip.py
Pip Commands
List installed python modules
pip list
Show details about a Python module
pip show virtualenv
Search for a Python module
pip search "query"
Install a Python module
pip install virtualenv
Upgrade a Python module
pip install --upgrade scipy
Upgrade pip
pip install --upgrade pip
Uninstall
pip uninstall virtualenv
Pip Config
There is a global config file and per user config file locations.
Global pip config file - example to format columns for all users
/etc/pip.conf [list] format=columns
User pip config file - for additional config or to over ride the global
- Create the pip config directory
mkdir ~/.config/pip/
- Create the pip.conf file and populate it
vim ~/.config/pip/pip.conf #your config here