3

I need to use CentOS 6.6 for a project which comes with Python 2.6 by default. When I install Swift it places the install inside /usr/lib/python2.6/site-packages/swiftclient/, so if I do a 'make altinstall' to install Python 2.7 or 3.3 it still runs with Python 2.6. I read from other similar questions that trying to just install 2.7 or 3.3 on top of 2.6 will break yum. The exception that occurs when running 'swift upload..' is:

Traceback (most recent call last):
  File "/usr/bin/swift", line 7, in <module>
from swiftclient.shell import main
  File "/usr/lib/python2.6/site-packages/swiftclient/__init__.py", line 20, in <module>
from .client import *  # noqa
  File "/usr/lib/python2.6/site-packages/swiftclient/client.py", line 136
return {key: safe_value(key, val) for (key, val) in headers}
                                    ^
SyntaxError: invalid syntax

Is there a way to install swift into the 2.7 directory? Is there some kind of environment variable I can change to point to Python2.7?

Thanks!

Eric Aya
  • 69,473
  • 35
  • 181
  • 253
TJ_
  • 328
  • 2
  • 13

1 Answers1

0

Obviously you can install swiftclient into python2.7 directory.

If you have installed python2.7 from sources with make altinstall you can then install pip2.7 and swiftclient `

wget https://bootstrap.pypa.io/ez_setup.py
/usr/local/bin/python2.7 ez_setup.py
/usr/local/bin/easy_install-2.7 pip
/usr/local/bin/pip2.7 install swiftclient 

The big deal though, is that you need to invoke explicitly python2.7 as the interpreter you want to use. Obviously you can set an env variable for it example export PYTHON27=/usr/local/bin/python2.7, but it has to be user/application specific and not system wide, 'cause as you already know, you will break yum dependencies.