Search code examples
pythonlinuxmodulewebfactionstripe-payments

I can only import the Stripe Python library under a certain version of Python


I use Webfaction, and this is the command line for the shared host.

[zallarak@web198 ~]$ python2.6
Python 2.6.5 (r265:79063, Nov 23 2010, 02:02:03) 
[GCC 4.1.2 20080704 (Red Hat 4.1.2-48)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import stripe
>>>

[zallarak@web198 ~]$ python2.7
Python 2.7.1 (r271:86832, Dec  1 2010, 06:29:57) 
[GCC 4.1.2 20080704 (Red Hat 4.1.2-48)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import stripe
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named stripe

I know there must be a simple way to make it work in all version of Python. I would much appreciate any insight on how to make this work/the concept behind it.

My version of Django runs on 2.7, so the goal is to make it work on 2.7


Solution

  • Your problem is that the stripe module is not installed in each python environment.

    I know there must be a simple way to make it work in all version of Python.

    You must install stripe in each environment. According to your webhost, you should be able to install them with easy_install. Try this:

    python2.7 `which easy_install` stripe