I run a Slackware system and I'm trying to run some Python code, but getting a lot of errors such as this one below:
>>> import urllib2
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.6/urllib2.py", line 91, in <module>
import hashlib
File "/usr/lib/python2.6/hashlib.py", line 136, in <module>
md5 = __get_builtin_constructor('md5')
File "/usr/lib/python2.6/hashlib.py", line 63, in __get_builtin_constructor
import _md5
ImportError: No module named _md5
urllib2 should be a rather basic lib with Python, how can I get Python working correctly?
Reason being is that urllib2
seems to be a dependancy of praw
: https://github.com/praw-dev/praw/issues/135
Trying to install pip to get this installed gives me:
Traceback (most recent call last):
File "setup.py", line 5, in <module>
from setuptools import setup
ImportError: No module named setuptools
So I tried installing setuptools:
running install
Traceback (most recent call last):
File "setup.py", line 94, in <module>
scripts = scripts,
File "/usr/lib/python2.6/distutils/core.py", line 152, in setup
dist.run_commands()
File "/usr/lib/python2.6/distutils/dist.py", line 975, in run_commands
self.run_command(cmd)
File "/usr/lib/python2.6/distutils/dist.py", line 995, in run_command
cmd_obj.run()
File "/root/setuptools-0.6c11/setuptools/command/install.py", line 76, in run
self.do_egg_install()
File "/root/setuptools-0.6c11/setuptools/command/install.py", line 85, in do_egg_install
easy_install = self.distribution.get_command_class('easy_install')
File "/root/setuptools-0.6c11/setuptools/dist.py", line 395, in get_command_class
self.cmdclass[command] = cmdclass = ep.load()
File "/root/setuptools-0.6c11/pkg_resources.py", line 1954, in load
entry = __import__(self.module_name, globals(),globals(), ['__name__'])
File "/root/setuptools-0.6c11/setuptools/command/easy_install.py", line 21, in <module>
from setuptools.package_index import PackageIndex, parse_bdist_wininst
File "/root/setuptools-0.6c11/setuptools/package_index.py", line 2, in <module>
import sys, os.path, re, urlparse, urllib2, shutil, random, socket, cStringIO
File "/usr/lib/python2.6/urllib2.py", line 91, in <module>
import hashlib
File "/usr/lib/python2.6/hashlib.py", line 136, in <module>
md5 = __get_builtin_constructor('md5')
File "/usr/lib/python2.6/hashlib.py", line 63, in __get_builtin_constructor
import _md5
ImportError: No module named _md5
_md5
– Zeno Oct 30 '12 at 19:47