1PCP-PYTHON(1) General Commands Manual PCP-PYTHON(1)
2
3
4
6 pcp-python - run a python script using a preferred python variant
7
9 pcp python [SCRIPT [ARG]...]
10
12 pcp-python provides a way to run python scripts using a customisable
13 python binary, rather than embedding any particular version of python
14 into each script.
15
16 This can be useful as it allows version-independent python code to be
17 run anywhere. All python modules shipped with PCP support versions 2.6
18 and later (in the python2 series), and 3.3 and later (in the python3
19 release series).
20
21 Due to python monitoring and collecting scripts being relatively simple
22 in PCP (not requiring new modules, language features, etc), it has been
23 possible to ensure they work for all of the above python versions.
24 Thus, it is common for PCP python scripts to use a "shebang" line that
25 invokes pcp-python as follows:
26
27 #!/usr/bin/pcp python
28
29 This allows the custom setting to be injected instead of a hard-coded
30 python version, while still allowing the user to override the python
31 version as follows:
32
33 $ PCP_PYTHON_PROG=python3 /usr/bin/pcp python --version
34 Python 3.3.2
35 $ PCP_PYTHON_PROG=python2 /usr/bin/pcp python --version
36 Python 2.7.5
37
38 This is convenient for shipping identical scripts on multiple plat‐
39 forms, and for testing different python versions with the one script
40 (e.g. in the case where multiple versions of python are installed,
41 PCP_PYTHON_PROG can be set in the local environment to override the
42 global setting).
43
44 By default, the value of PCP_PYTHON_PROG from /etc/pcp.conf will be
45 used. The default value of this configuration parameter is set depend‐
46 ing on some heuristics about the target build platform. These heuris‐
47 tics favour the use of python3 in all recent releases of PCP, for those
48 platforms that support it.
49
51 Environment variables with the prefix PCP_ are used to parameterize the
52 file and directory names used by PCP. On each installation, the file
53 /etc/pcp.conf contains the local values for these variables. The
54 $PCP_CONF variable may be used to specify an alternative configuration
55 file, as described in pcp.conf(5).
56
58 pcp(1) and PCPIntro(1).
59
60
61
62Performance Co-Pilot PCP PCP-PYTHON(1)