我使用 Webfaction,这是共享主机的命令行。
[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
我知道一定有一种简单的方法可以让它在所有版本的 Python 中工作。我将非常感谢任何关于如何使这项工作/它背后的概念的见解。
我的 Django 版本在 2.7 上运行,所以目标是让它在 2.7 上运行
最佳答案
你的问题是 stripe
模块没有安装在每个 python 环境中。
I know there must be a simple way to make it work in all version of Python.
您必须在每个环境中安装stripe
。根据your webhost ,您应该能够使用 easy_install
安装它们。试试这个:
python2.7 `which easy_install` stripe
关于python - 我只能在某个版本的Python下导入Stripe Python库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8364972/