2

I have a Centos 6.6 Docker image being used for an automated build. It has the default x64 Python 2.6.6 installed. I need to run some things in a 32-bit Python environment. I snagged the python-2.6.6-52.el6.i686.rpm and got it installed.

When I check the output of "yum info python", I see both i686 and x86_64 versions.

Now, the problem: when I want to run something and force 32-bit, how do I do it? For example, I need to install a number of dependencies using pip...how to get pip to use the 32-bit environment?

1

I recommend you download and install virtualenv and then create a virtual environment by using:

virtualenv --python=/path/to/your/32bit_python_exe ~/py32
source ~/py32/bin/activate

(this assuming your use bash). Until you issue the deactivate command, in this shell, python will be your 32 bit version, and pip will install to this virtualenv.

If you also do x64 Python development, it is better to use virtualenvs for that as well and not pollute (or break) the global python (on which proper functioning some system utilities are depending).

You can additionally take a look at virtualenvwrapper to ease the management of multiple virtualenv environments.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.