简体   繁体   中英

Does using site packages installed for 32-bit Python introduce memory limitations if they are also used with 64-bit Python?

Aside from the obvious solution of "just install the respective package(s) with your 64-bit Python version" , and aside from justifying valid use cases, I am after some technical insight into this scenario.

As an example, say I am running a Python script with a 64-bit Python version , which includes something along the lines of below:

sys.path.append("some 32 bit Python version site package path")

import some_32bit_library

# do stuff with some_32bit_library...

Such that some_32bit_library is being imported and used from the 32-bit version of Python.

Even though the overall script is run with a 64-bit Python, will importing and using this some_32bit_library introduce a memory limit because it is from a 32-bit version?

I am aware that a 32-bit application itself is limited to accessing ~4GB of memory. The question is, will using the 32-bit library via a Python script running with a 64-bit version also have the same ~4GB limitation?

Any answer/insight would be appreciated, thank you.

It simply will not work. When a package is labeled 32 or 64, that means it contains binary libraries. You cannot load a 32-bit library into a 64-bit process, nor vice versa.

If the package is Python only (no binary), then it is probably bit-for-bit identical, and will work fine.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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