python - How to make rpm module work with (non-system) Python2.7 -


i haven't found comprehensive answer issue far. sorry in advance if missed answer somewhere.

i have rhel5/oel5 64 bit os native python-2.4 on , rpm-python-4.4.2.3-27.0.1.el5 installed. when doing 'import rpm' python-2.4 works expected.

i (must) use python rpm module python-2.7.5 on same machine , not sure proper way of doing that. python 2.7.5 installed. when calling 'import rpm' got import error.

i've found few rpms python-2.7.5 however, not rhel5/oel5 64 bit

appreciate pointers/advise!

a solution python 2.7 use virtualenv.

in nutshell, virtualenv allows manage several versions of python on same computer (even same user) without getting in each other's way. allows have several "flavors" of same python version, each different set of modules.

the process described in detail in documentation.

in case, create environment , use pip install rpm module environment. when activate environment, python scripts able import rpm module long start them inside environment (usually, same terminal or shell process).

this not affect existing installation of 2.7 nor old python 2.4.

[edit] there no pip module rpm-module. depending on how module works, should try download source rpm (*.src.rpm) , modify spec file until takes python 2.7 build , installs python 2.7 module path.

[edit2] steps fix problem:

  1. i opened tar tar -zxvf rpm-4.4.2.3.tar.gz
  2. vi configure -----> changed instances of python2.5 python2.7
  3. ./autogen.sh
  4. gmake
  5. gmake -n install > log
  6. check log file make sure doesn't install in wrong places.
  7. gmake install install real

Comments

Popular posts from this blog

java - activate/deactivate sonar maven plugin by profile? -

python - TypeError: can only concatenate tuple (not "float") to tuple -

java - What is the difference between String. and String.this. ? -