Error with a Python package: "wrong ELF class: ELFCLASS64" (Compiling in 32 bit on 64bit system?)
I'm trying to easy_install a Python package called "lxml" on my shared server. However, I had to do that locally, as I cannot fork processes on my online server.
- Both my prod and dev server are Ubuntu64, but only my offline dev had python-64, while my prod has 32bit.
- Python version is 2.6.6.
- I'm using virtualenv
So I built it on my dev server (using pip), then I simply uploaded on my prod server (via ftp). But I got this error:
django.core.exceptions.ImproperlyConfigured: Error importing middleware pootle_misc.middleware.siteconfig: "/accounts/gabriobald/www/translate.9thcircle.it/lib/python2.6/site-packages/lxml/etree.so: wrong ELF class: ELFCLASS64"
I guess it's because of the binded library etree.so
So, the poi开发者_JAVA百科nt is: is there a way to easy_install a Python package in 32 bit on a 64 bit system?
With easy_install you can specify the exact package you want to install. If the 32bits version of the package would be available you could download it and then execute: easy_install ./lxml-2.3-py-2.6-linux_i386.egg. However I think that for lxml there is not a precompiled version for linux 32bits and your version of python.
In this link you can find how to build a 32 bit python module on a 64 bits system. But you will need a 32 bit version of python and all its dependencies so you it won't work in your current development environment (you mentioned you have a 64 bits version).
It is highly recommended to have the development environment as close as possible to the production environment so you don't find 'surprises' when deploying into production. Sometimes is not possible to have the exact same environment just because of differences in the operating system. This is one of the reasons why we package the BitNami Django Stack and virtual appliance (I'm a BitNami developer). The stack is a self-contained, multi-platform package for developers. Also it is completely independent of the user system and will not interfere with anything else in the system. Developing on top of the stack and use it for production assure you that you will have the same environment in both systems. In any case you already have a production server and if using the stack is not an option for you (you would need to migrate your applications) I would recommend that you set your development environment also with the 32bits version of python and dependencies.
精彩评论