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