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

发布于 2024-12-19 05:18:11 字数 770 浏览 2 评论 0原文

我使用 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 上运行

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

箹锭⒈辈孓 2024-12-26 05:18:11

您的问题是 stripe 模块并未安装在每个 python 环境中。

我知道一定有一种简单的方法可以让它在所有版本的 Python 中工作。

您必须在每个环境中安装stripe。根据您的网站主机,您应该能够使用 easy_install 安装它们。试试这个:

python2.7 `which easy_install` stripe

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
探春 2024-12-26 05:18:11

Brian Cain 关于它没有安装在您正在使用的 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版本。

Brian Cain is correct about it not being installed in the Python version you are using. Instead of the command he gave you should run:

easy_install-2.7 stripe

After making sure that the directory: /home/username/lib/python2.7/ actually exists. If it doesn't you can use the command: mkdir -p /home/username/lib/python2.7 to create it.

That will install it in your Python2.7 installation, which you can then use from Django on Python2.7.

Note: If you get the error: "Need libcurl version 7.19.0 or greater to compile pycurl." you'll need to follow the instructions here:

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

to install your own version of curl on your account.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文