问题:我应该使用Python 32位还是Python 64位

我有一个win7 64位安装。我必须使用Python 64位吗?无论如何,32位和64位Python版本之间有什么区别?不同的Python软件包(例如south,django,mysqldb等)仅支持32位/ 64位吗?

I have a win7 64bit installation. Must I use Python 64bit? What are the differences between the 32bit and 64bit Python versions anyway? Do different Python packages (such as south, django, mysqldb etc) support only 32bit/64bit?


回答 0

64位版本将允许单个进程使用比32位更多的RAM,但是您可能会发现,内存占用量会增加一倍,具体取决于您存储在RAM中的内容(尤其是整数)。

例如,如果您的应用程序需要大于2GB的RAM,那么从32位切换到64位,您可能会发现您的应用程序现在需要大于4GB的RAM。

检查您的所有第三方模块是否都可用64位,否则同时坚持使用32位可能会更容易

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).

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.

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


回答 1

以我的经验,使用32位版本会更轻松。除非您正在处理大量使用内存的应用程序(大多数情况下是科学计算,使用的内存超过2GB),否则最好使用32位版本,因为:

  1. 通常,您使用较少的内存。
  2. 使用COM的问题更少(因为您在Windows上)。
  3. 如果必须加载DLL,则它们很可能也是32位的。如果没有一些笨拙的代码运行另一个Python(这次是32位并使用IPC),则Python 64位无法加载32位库。
  4. 如果必须加载自己编译的DLL,则必须将它们编译为64位,这通常较难做到(特别是在Windows上使用MinGW时)。
  5. 如果您曾经使用PyInstaller或py2exe,这些工具将生成与Python解释器相同位的可执行文件。

In my experience, using the 32-bit version is more trouble-free. 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:

  1. You generally use less memory.
  2. You have less problems using COM (since you are on Windows).
  3. If you have to load DLLs, they most probably are also 32-bit. Python 64-bit can’t load 32-bit libraries without some heavy hacks running another Python, this time in 32-bit, and using 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).
  5. If you ever use PyInstaller or py2exe, those tools will generate executables with the same bitness of your Python interpreter.

回答 2

您不需要使用64位,因为Windows将使用wow64模拟32位程序。但是使用本机版本(64位)将为您带来更高的性能。

You do not need to use 64bit since windows will emulate 32bit programs using wow64. But using the native version (64bit) will give you more performance.


回答 3

仅在必须处理大量数据的情况下才使用64位版本,在这种情况下,John La Rooy所说的不便之处在于64位的性能更好。如果不是,请坚持使用32位。

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; if not, stick with the 32 bits.


回答 4

我在32中运行python应用程序(运行大型数据帧)时遇到了麻烦-收到MemoryError消息,而在64上运行良好。

I had trouble running python app (running large dataframes) in 32 – got MemoryError message, while on 64 it worked fine.


回答 5

像tensorflow 2.x这样的机器学习软件包被设计为仅在64位Python上运行,因为它们占用大量内存。

Machine learning packages like tensorflow 2.x are designed to work only on 64 bit Python as they are memory intensive.


声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。