[英]Python: how to import 32bit module for 64bit python
Due to the system limits, I can only use a 64bit version Python, though, some of the modules that I intend to use do not come with a 64bit version (eg httplib2). 由于系统限制,我只能使用64位版本的Python,但我打算使用的一些模块没有64位版本(例如httplib2)。 In this case, what am I supposed to do so as to leverage those 32bit functions?
在这种情况下,我应该怎么做以利用这些32位功能?
Thanks for the answer by j_mcnally. 感谢j_mcnally的回答。 That works.
这样可行。 Another approach that eventually works for me is to use the prefix parameter if there are multi-versions(eg 32/64) of python installed:
最终适用于我的另一种方法是在安装了多版本(例如32/64)的python时使用prefix参数:
python setup.py install --prefix = "your python root directory"
python setup.py install --prefix =“你的python根目录”
Excuse my ignorance, but can't you compile them as 64 bit modules? 请原谅我的无知,但你不能把它们编译成64位模块吗?
http://code.google.com/p/httplib2/ http://code.google.com/p/httplib2/
the source is there. 来源就在那里。 I would image most modern ./configure scripts will detect your arch, and compile the appropriate extension.
我想成像最现代的./configure脚本将检测你的arch,并编译适当的扩展。
the following seems to work for me: 以下似乎对我有用:
ARCHFLAGS='-arch x86_64' python setup.py install
running install running bdist_egg running egg_info writing
运行安装运行bdist_egg运行egg_info写入
python2/httplib2.egg-info/PKG-INFO writing top-level names to
python2 / httplib2.egg-info / PKG-INFO将顶级名称写入
python2/httplib2.egg-info/top_level.txt writing dependency_links to
将dependency_links写入的python2 / httplib2.egg-info / top_level.txt
python2/httplib2.egg-info/dependency_links.txt reading manifest file
python2 / httplib2.egg-info / dependency_links.txt读取清单文件
'python2/httplib2.egg-info/SOURCES.txt' reading manifest template
'python2 / httplib2.egg-info / SOURCES.txt'阅读清单模板
'MANIFEST.in' writing manifest file
'MANIFEST.in'写清单文件
'python2/httplib2.egg-info/SOURCES.txt' installing library code to
'python2 / httplib2.egg-info / SOURCES.txt'安装库代码
build/bdist.macosx-10.8-x86_64/egg running install_lib running
build / bdist.macosx-10.8-x86_64 / egg运行install_lib正在运行
build_py creating build creating build/lib creating build/lib/httplib2
build_py创建构建创建build / lib创建build / lib / httplib2
copying python2/httplib2/ init .py -> build/lib/httplib2 copying
复制python2 / httplib2 / init .py - > build / lib / httplib2复制
python2/httplib2/iri2uri.py -> build/lib/httplib2 copying
python2 / httplib2 / iri2uri.py - > build / lib / httplib2复制
python2/httplib2/socks.py -> build/lib/httplib2 copying
python2 / httplib2 / socks.py - > build / lib / httplib2复制
python2/httplib2/cacerts.txt -> build/lib/httplib2 creating
python2 / httplib2 / cacerts.txt - > build / lib / httplib2创建
build/bdist.macosx-10.8- x86_64 creating
build / bdist.macosx-10.8- x86_64创建
build/bdist.macosx-10.8- x86_64 /egg creating
build / bdist.macosx-10.8- x86_64 / egg creation
http://www.lfd.uci.edu/~gohlke/pythonlibs/ http://www.lfd.uci.edu/~gohlke/pythonlibs/
This guy has made a windows installer (see Base-12.9.15.win-amd64-py2.7.exe at the bottom) for many, many modules used in scientific python. 对于科学python中使用的许多模块,这个人已经制作了一个Windows安装程序(参见底部的Base-12.9.15.win-amd64-py2.7.exe)。 Consider using it, if you're not comfortable compiling from source.
如果您不熟悉从源代码编译,请考虑使用它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.