linux_wiki:python

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
linux_wiki:python [2016/03/28 22:00]
billdozor [Software Collections]
linux_wiki:python [2019/05/25 23:50] (current)
Line 12: Line 12:
 ===== Python Versions ===== ===== Python Versions =====
  
-^  OS  ^  System Package  ^  Software Collections +^  OS  ^  System Package   EPEL   Software Collections 
-|  CentOS 6.x  |  2.6.6  |  2.7, 3.3  | +|  CentOS 6.x  |  2.6.6   3.4   2.7, 3.3, 3.4  | 
-|  CentOS 7.x  |  2.7.  2.7, 3.3  |+|  CentOS 7.x  |  2.7   3.4, 3.6   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. +  * To avoid breaking system packages(ie yum uses python), let system packaged python versions stay maintained by the official repos. 
-  * Use software collections or something such as virtualenv to maintain development environments.+  * Use EPEL/software collections along with something such as virtualenv to maintain development environments.
  
 ---- ----
  
-===== Software Collections =====+====== Python3 Install: EPEL ====== 
 + 
 +To install python 3.4 from the EPEL 
 +  * 3.4<code bash>yum install python34</code> 
 +  * 3.6<code bash>yum install python36</code> 
 + 
 +---- 
 + 
 +====== 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. Software Collections allow for environments such as newer Python versions to be installed via repos and not conflict with the default system version.
Line 29: Line 37:
 ---- ----
  
-===== Pip =====+====== Pip ======
  
 Pip is a Python package management tool to install modules. Pip is a Python package management tool to install modules.
  
-==== Install Pip ==== +===== Install Pip =====
-<code bash> +
-wget https://bootstrap.pypa.io/get-pip.py +
-python get-pip.py +
-</code>+
  
-==== Pip Commands ====+Install Pip into a Python environment 
 +  * Python2<code bash>wget https://bootstrap.pypa.io/get-pip.py 
 +python get-pip.py</code> 
 +  * Python3<code bash>wget https://bootstrap.pypa.io/get-pip.py 
 +python3.6 get-pip.py</code> 
 + 
 +\\ 
 +Install devel packages that many pip builds rely upon 
 +  * Python2<code bash>yum install gcc python-devel</code> 
 +  * Python3.4<code bash>yum install gcc python34-devel</code> 
 +  * Python3.6<code bash>yum install gcc python36-devel</code> 
 +===== Pip Commands ====
 + 
 +**Python 2 vs Python 3 pip commands** 
 +  * **Python 2**<code bash>pip <command></code> 
 +  * **Python 3**<code bash>pip3 <command></code> 
 + 
 +\\
 List installed python modules List installed python modules
 <code bash> <code bash>
Line 45: Line 66:
 </code> </code>
  
 +\\
 Show details about a Python module Show details about a Python module
 <code bash> <code bash>
Line 50: Line 72:
 </code> </code>
  
 +\\
 Search for a Python module Search for a Python module
 <code bash> <code bash>
Line 55: Line 78:
 </code> </code>
  
 +\\
 Install a Python module Install a Python module
 <code bash> <code bash>
Line 60: Line 84:
 </code> </code>
  
 +\\
 Upgrade a Python module Upgrade a Python module
 <code bash> <code bash>
Line 65: Line 90:
 </code> </code>
  
 +\\
 Upgrade pip Upgrade pip
 <code bash> <code bash>
Line 70: Line 96:
 </code> </code>
  
 +\\
 Uninstall Uninstall
 <code bash> <code bash>
Line 76: Line 103:
  
 ---- ----
 +
 +===== 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<code bash>/etc/pip.conf
 +[list]
 +format=columns
 +</code>
 +
 +\\
 +**User pip config file** - for additional config or to over ride the global
 +  * Create the pip config directory<code bash>mkdir ~/.config/pip/</code>
 +  * Create the pip.conf file and populate it<code bash>vim ~/.config/pip/pip.conf
 +
 +#your config here</code>
 +
 +----
 +
 +====== Python Modules ======
 +
 +Some commonly installed Python modules.
 +
 +===== Virtualenv =====
 +
 +Virtualenv "is a tool to create isolated Python environments."
 +
 +Site: https://virtualenv.pypa.io/en/stable/
 +
 +  * Python2<code bash>pip install virtualenv</code>
 +  * Python3<code bash>pip3 install virtualenv</code>
 +
 +----
 +
 +===== PipEnv =====
 +
 +PipEnv "automatically creates and manages a virtualenv for your projects, as well as adds/removes packages from your Pipfile as you install/uninstall packages. It also generates the ever–important Pipfile.lock, which is used to produce deterministic builds."
 +
 +Site: https://github.com/pypa/pipenv
 +
 +  * Python2<code bash>pip install pipenv</code>
 +  * Python3<code bash>pip3 install pipenv</code>
 +
 +----
 +
 +===== AWS CLI =====
 +
 +AWS CLI "is a unified tool to manage your AWS services. With just one tool to download and configure, you can control multiple AWS services from the command line and automate them through scripts."
 +
 +Site: https://aws.amazon.com/cli/
 +
 +Pre-Reqs<code bash>yum install expat-devel</code>
 +
 +Install
 +  * Python2<code bash>pip install awscli</code>
 +  * Python3<code bash>pip3 install awscli</code>
 +
 +Verify
 +  * Python2 and Python3<code bash>aws --version</code>
 +
 +==== Cert Verify Failed ====
 +
 +If you are seeing errors while using the aws cli about "SSL: CERTIFICATE_VERIFY_FAILED"
 +  * Point the aws cli to the system ca bundle (**per user**)<code bash>vim ~/.bashrc
 +
 +# AWS CA Bundle
 +export AWS_CA_BUNDLE="/etc/pki/tls/certs/ca-bundle.crt"</code>
 +  * Source the file<code bash>source ~/.bashrc</code>
 +
 +----
 +
  • linux_wiki/python.1459216800.txt.gz
  • Last modified: 2019/05/25 23:50
  • (external edit)