我只能在特定版本的Python下导入stripepython库

2024-10-02 08:25:54 发布

您现在位置:Python中文网/ 问答频道 /正文

我使用webfection,这是共享主机的命令行。在

[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上运行


Tags: orforlicenseonhattypehelpred
2条回答

您的问题是,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

briancain没有在您使用的Python版本中安装它是正确的。而不是他给你的命令:

easy_install-2.7 stripe

在确保目录:/home/username/lib/python2.7/确实存在之后。如果没有,您可以使用命令:mkdir -p /home/username/lib/python2.7来创建它。在

这将在Python2.7安装中安装它,然后可以从Python2.7上的Django中使用它。在

注意:如果出现错误:“需要libcurl 7.19.0或更高版本来编译pycurl。”您需要按照以下说明操作:

http://community.webfaction.com/questions/6365/problems-installing-pycurl

在你的帐户上安装你自己的curl版本。在

相关问题 更多 >

    热门问题