简体   繁体   English

我应该使用 Python 32bit 还是 Python 64bit

[英]Should I use Python 32bit or Python 64bit

I have a win7 64bit installation.我有一个win7 64位安装。 Must I use Python 64bit?我必须使用 Python 64 位吗? What are the differences between the 32bit and 64bit Python versions anyway?无论如何,32 位和 64 位 Python 版本之间有什么区别? Do different Python packages (such as south, django, mysqldb etc) support only 32bit/64bit?不同的 Python 包(例如 south、django、mysqldb 等)是否只支持 32 位/64 位?

64 bit version will allow a single process to use more RAM than 32 bit, however you may find that the memory footprint doubles depending on what you are storing in RAM (Integers in particular). 64 位版本将允许单个进程使用比 32 位更多的 RAM,但是您可能会发现内存占用量加倍取决于您在 RAM 中存储的内容(尤其是整数)。

For example if your app requires > 2GB of RAM, so you switch from 32bit to 64bit you may find that your app is now requiring > 4GB of RAM.例如,如果您的应用需要 > 2GB 的 RAM,因此您从 32 位切换到 64 位,您可能会发现您的应用现在需要 > 4GB 的 RAM。

Check whether all of your 3rd party modules are available in 64 bit, otherwise it may be easier to stick to 32bit in the meantime检查您的所有 3rd 方模块是否在 64 位可用,否则同时坚持 32 位可能更容易

In my experience, using the 32-bit version is more trouble-free.根据我的经验,使用 32 位版本更无故障。 Unless you are working on applications that make heavy use of memory (mostly scientific computing, that uses more than 2GB memory), you're better off with 32-bit versions because:除非您正在处理大量使用内存的应用程序(主要是科学计算,使用超过 2GB 的内存),否则最好使用 32 位版本,因为:

  1. You generally use less memory.您通常使用较少的内存。
  2. You have less problems using COM (since you are on Windows).使用 COM 的问题较少(因为您使用的是 Windows)。
  3. If you have to load DLLs, they most probably are also 32-bit.如果您必须加载 DLL,它们很可能也是 32 位的。 Python 64-bit can't load 32-bit libraries without some heavy hacks running another Python, this time in 32-bit, and using IPC. Python 64 位无法加载 32 位库,除非运行另一个 Python(这次是 32 位)并使用 IPC。
  4. If you have to load DLLs that you compile yourself, you'll have to compile them to 64-bit, which is usually harder to do (specially if using MinGW on Windows).如果必须加载自己编译的 DLL,则必须将它们编译为 64 位,这通常很难做到(特别是在 Windows 上使用 MinGW 时)。
  5. If you ever use PyInstaller or py2exe, those tools will generate executables with the same bitness of your Python interpreter.如果您曾经使用过 PyInstaller 或 py2exe,这些工具将生成与您的 Python 解释器具有相同位数的可执行文件。

You do not need to use 64bit since windows will emulate 32bit programs using wow64.您不需要使用 64 位,因为 Windows 将使用 wow64 模拟 32 位程序。 But using the native version (64bit) will give you more performance.但是使用本机版本(64 位)将为您提供更高的性能。

Use the 64 bit version only if you have to work with heavy amounts of data, in that scenario, the 64 bits performs better with the inconvenient that John La Rooy said;仅当您必须处理大量数据时才使用 64 位版本,在这种情况下,64 位的性能更好,但有 John La Rooy 所说的不便; if not, stick with the 32 bits.如果没有,请坚持使用 32 位。

我在 32 时运行 python 应用程序(运行大型数据帧)时遇到问题 - 收到 MemoryError 消息,而在 64 时它运行良好。

像 tensorflow 2.x 这样的机器学习包被设计为只在 64 位 Python 上工作,因为它们是内存密集型的。

I was using 32 bit version since getting the torch install error.自从收到火炬安装错误以来,我一直在使用 32 位版本。 Then i download 64 bit python problem solved.然后我下载64位python问题解决了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM