如何在 Debian 6 上为 Python3.2 安装 pip/easy_install

如何在 Debian 6 上为 Python3.2 安装 pip/easy_install

我正在尝试安装 pip 或安装 python 工具3.2在 Debian6

第一种情况:

apt-get install python3-pip...好的

python3 easy_install.py webob

Searching for webob
Reading http://pypi.python.org/simple/webob/
Reading http://webob.org/
Reading http://pythonpaste.org/webob/
Best match: WebOb 1.2.2
Downloading http://pypi.python.org/packages/source/W/WebOb/WebOb-1.2.2.zip#md5=de0f371b46554709ce5b93c088a11cae
Processing WebOb-1.2.2.zip
Traceback (most recent call last):
  File "easy_install.py", line 5, in <module>
    main()
  File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 1931, in main
    with_ei_usage(lambda:
  File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 1912, in with_ei_usage
    return f()
  File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 1935, in <lambda>
    distclass=DistributionWithoutHelpCommands, **kw
  File "/usr/local/lib/python3.2/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/usr/local/lib/python3.2/distutils/dist.py", line 917, in run_commands
    self.run_command(cmd)
  File "/usr/local/lib/python3.2/distutils/dist.py", line 936, in run_command
    cmd_obj.run()
  File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 368, in run
    self.easy_install(spec, not self.no_deps)
  File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 608, in easy_install
    return self.install_item(spec, dist.location, tmpdir, deps)
  File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 638, in install_item
    dists = self.install_eggs(spec, download, tmpdir)
  File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 799, in install_eggs
    unpack_archive(dist_filename, tmpdir, self.unpack_progress)
  File "/usr/lib/python3/dist-packages/setuptools/archive_util.py", line 67, in unpack_archive
    driver(filename, extract_dir, progress_filter)
  File "/usr/lib/python3/dist-packages/setuptools/archive_util.py", line 154, in unpack_zipfile
    data = z.read(info.filename)
  File "/usr/local/lib/python3.2/zipfile.py", line 891, in read
    with self.open(name, "r", pwd) as fp:
  File "/usr/local/lib/python3.2/zipfile.py", line 980, in open
    close_fileobj=not self._filePassed)
  File "/usr/local/lib/python3.2/zipfile.py", line 489, in __init__
    self._decompressor = zlib.decompressobj(-15)
AttributeError: 'NoneType' object has no attribute 'decompressobj'

第二种情况:来自http://pypi.python.org/pypi/distribute#installation-instructions

python3 分发_设置.py

Downloading http://pypi.python.org/packages/source/d/distribute/distribute-0.6.28.tar.gz
Extracting in /tmp/tmpv6iei2
Traceback (most recent call last):
  File "distribute_setup.py", line 515, in <module>
    main(sys.argv[1:])
  File "distribute_setup.py", line 511, in main
    _install(tarball, _build_install_args(argv))
  File "distribute_setup.py", line 73, in _install
    tar = tarfile.open(tarball)
  File "/usr/local/lib/python3.2/tarfile.py", line 1746, in open
    raise ReadError("file could not be opened successfully")
tarfile.ReadError: file could not be opened successfully

第三种情况:来自http://pypi.python.org/pypi/distribute#installation-instructions tar -xzvf 分发-0.6.28.tar.gz cd 分发-0.6.28 python3setup.py 安装

Before install bootstrap.
Scanning installed packages
No setuptools distribution found
running install
running bdist_egg
running egg_info
writing distribute.egg-info/PKG-INFO
writing top-level names to distribute.egg-info/top_level.txt
writing dependency_links to distribute.egg-info/dependency_links.txt
writing entry points to distribute.egg-info/entry_points.txt
reading manifest file 'distribute.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'distribute.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
copying distribute.egg-info/PKG-INFO -> build/bdist.linux-x86_64/egg/EGG-INFO
copying distribute.egg-info/SOURCES.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying distribute.egg-info/dependency_links.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying distribute.egg-info/entry_points.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying distribute.egg-info/top_level.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
creating 'dist/distribute-0.6.28-py3.2.egg' and adding 'build/bdist.linux-x86_64/egg' to it
Traceback (most recent call last):
  File "setup.py", line 220, in <module>
    scripts = scripts,
  File "/usr/local/lib/python3.2/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/usr/local/lib/python3.2/distutils/dist.py", line 917, in run_commands
    self.run_command(cmd)
  File "/usr/local/lib/python3.2/distutils/dist.py", line 936, in run_command
    cmd_obj.run()
  File "build/src/setuptools/command/install.py", line 73, in run
    self.do_egg_install()
  File "build/src/setuptools/command/install.py", line 93, in do_egg_install
    self.run_command('bdist_egg')
  File "/usr/local/lib/python3.2/distutils/cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "/usr/local/lib/python3.2/distutils/dist.py", line 936, in run_command
    cmd_obj.run()
  File "build/src/setuptools/command/bdist_egg.py", line 241, in run
    dry_run=self.dry_run, mode=self.gen_header())
  File "build/src/setuptools/command/bdist_egg.py", line 542, in make_zipfile
    z = zipfile.ZipFile(zip_filename, mode, compression=compression)
  File "/usr/local/lib/python3.2/zipfile.py", line 689, in __init__
    "Compression requires the (missing) zlib module")
RuntimeError: Compression requires the (missing) zlib module

zlib1g-dev已安装

请帮帮我

答案1

安装 Python 后是否安装了 zlib1g-dev?如果安装 Python 时 zlib 不可用,则它已被遗漏。您可以通过打开 Python shell 并尝试 来确认import zlib,我预计这会失败。如果您确定已安装 zlib1g-dev,请重新安装 Python。

相关内容