Christopher Juckins

SysAdmin Tips, Tricks and other Software Tools

User Tools

Site Tools


Python Notes

With CentOS7.7, python3 can load from base. Do the following to fix previously-installed IUS release:

# yum remove python36u
# yum install python3
# yum remove ius-release
  • Then follow instructions for installing local python packages to ensure all still work.
  • If you have pip problems, uninstall/reinstall using instructions at
  • Ensure pip3.6 is in your $PATH or you have a sym link to it (/usr/local/bin) in /usr/bin

Install Python 3.6 on CentOS 7:

Do some local configuration for my scripts (su - root):

pip3.6 install --upgrade pip
pip3.6 install --upgrade httplib2
pip3.6 install pymysql
pip3.6 install selenium-wire
pip3.6 install chromedriver
pip3.6 install chromedriver_binary
pip3.6 install dictor
pip3.6 install wget
pip3.6 install pip-upgrade-outdated

To update all pip packages:

# pip_upgrade_outdated

Note that is a good resource to update all PIP packages.

Download and install geckodriver (see

As root, copy geckodriver to /usr/local/bin and ensure permissions are 755

Notes at

Notes about Python database access

Python3.7 on Fedora 28:

Use “pip” to manage python packages:

# yum install python2-pip

To list installed python modules:

$ pip list

Logging in python

logging.basicConfig(format='%(asctime)s %(message)s', filename=log_file, level=logging.DEBUG)
logging.debug('This message should go to the log file')'So should this')
logging.warning('And this, too')

Write beautiful python code with PEP-8

python_notes.txt · Last modified: 2019/09/30 17:12 by juckins