开发者

python using easy_install ImportError: No module named _md5

开发者 https://www.devze.com 2023-01-26 18:34 出处:网络
I searched a lot and did not find any answer to this problem =( I have a CentOS 5 as a server, following this How To:

I searched a lot and did not find any answer to this problem =(

I have a CentOS 5 as a server, following this How To: http://wiki.osqa.net/display/docs/RHEL%2C+CentOS+5+Installation+Guide#RHEL%2CCentOS5InstallationGuide-Python

I'm able to install python 2.6 separated from the yum version. But when I run ./easy_install ElementTree I get this strange error:

    Traceback (most recent call last):
  File "./easy_install", line 9, in <module>
    load_entry_point('distribute==0.6.14', 'console_scripts', 'easy_install')()
  File "/opt/ActivePython-2.6/lib/python2.6/site-packages/pkg_resources.py", line 305, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/opt/ActivePython-2.6/lib/python2.6/site-packag开发者_运维百科es/pkg_resources.py", line 2244, in load_entry_point
    return ep.load()
  File "/opt/ActivePython-2.6/lib/python2.6/site-packages/pkg_resources.py", line 1954, in load
    entry = __import__(self.module_name, globals(),globals(), ['__name__'])
  File "/opt/ActivePython-2.6/lib/python2.6/site-packages/setuptools/command/easy_install.py", line 24, in <module>
    from setuptools.package_index import PackageIndex
  File "/opt/ActivePython-2.6/lib/python2.6/site-packages/setuptools/package_index.py", line 2, in <module>
    import sys, os.path, re, urlparse, urllib2, shutil, random, socket, cStringIO
  File "/opt/ActivePython-2.6/lib/python2.6/urllib2.py", line 93, in <module>
    import hashlib
  File "/opt/ActivePython-2.6/lib/python2.6/hashlib.py", line 136, in <module>
    md5 = __get_builtin_constructor('md5')
  File "/opt/ActivePython-2.6/lib/python2.6/hashlib.py", line 63, in __get_builtin_constructor
    import _md5
ImportError: No module named _md5

I do not understand python and have no idea how to fix this issue, I'm trying to install OSQA to run a phpBB support forum for another country.

Thanks for any help, best regard's.


My guess having had a similar issue on CentOS before, is that the ld path for the new Python isn't set, and it can't find its loadable modules folder.

The 3rd code block on this blog post shows setting an ld path for an opt Python (though it is 2.7): http://toey.tc20.net/2010/08/04/install-python-2-7-gevent-on-centos-5-x86_64/

I would assume that an installer would have done this as part of the install step, but maybe the blog post above will be of some help.


I had the same problem and found that the issue is unrelated to _md5.so, but instead that hashlib is failing to import _hashlib.so within a try block, then getting to a different and normally unused section of code (where the _md5 problem shows up). Try:

import _hashlib.so

I got something like:

ImportError: <PATH>/lib/python2.7/lib-dynload/_hashlib.so: cannot restore segment prot after reloc: Permission denied

I googled that and found http://www.quantumwise.com/forum/index.php?topic=16.0 which says you need to do:

chcon -t texrel_shlib_t <PATH>/lib/python2.7/lib-dynload/_hashlib.so

This worked for me.


Activepython 2.6 seems to have some problem in their latest build. please check for its former release.


I also encounter the same issue like you, I fix it after I add the lib path of python where the module will be installed.

It is really caused by LD_LIBRARY_PATH, please try to add "/opt/ActivePython-2.6/lib" into your LD_LIBRARY_PATH.

setenv LD_LIBRARY_PATH /opt/ActivePython-2.6/lib:$LD_LIBRARY_PATH


Credit to http://johnsofteng.wordpress.com/2009/06/21/python-importerror-no-module-named-_md5/

I met the similar problem on Redhat 6.4, python binary (2.7.x) packages is copied from other already installed system (which is built from source).

The problem is the _hashlib.so, which miss the libssl.so.0.9.8

bash-4.1# ldd /proj/application/tools/python2.7/lib/python2.7/lib-dynload/_hashlib.so
    linux-vdso.so.1 =>  (0x00007fff51d6f000)
    libssl.so.0.9.8 => not found
    libcrypto.so.0.9.8 => /usr/lib64/libcrypto.so.0.9.8 (0x00007f9a69746000)
    libpython2.7.so.1.0 => /proj/application/tools/python2.7/lib/libpython2.7.so.1.0 (0x00007f9a6936b000)

I just install missed package and soft link to the library.

bash-4.1# yum install -y tar openssh-clients
bash-4.1# ln -s /usr/lib64/libssl.so.0.9.8e /usr/lib64/libssl.so.0.9.8

Then the setuptool installation is successful

0

精彩评论

暂无评论...
验证码 换一张
取 消