Frage

Ich habe kompiliert und installiert Python 2.7 auf meinem ubuntu klar.
Aber ich bin nicht in der Lage Setuptools für 2.7 Python zu installieren, da die Daten Dekompression Modul zlib nicht vorhanden ist. Dies ist die genaue Fehlermeldung angezeigt:

 Traceback (most recent call last):
  File "setup.py", line 94, in <module>
    scripts = scripts,
  File "/usr/local/lib/python2.7/distutils/core.py", line 152, in setup
    dist.run_commands()
  File "/usr/local/lib/python2.7/distutils/dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "/usr/local/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/home/rohan/setuptools-0.6c11/setuptools/command/install.py", line 76, in run
    self.do_egg_install()
  File "/home/rohan/setuptools-0.6c11/setuptools/command/install.py", line 96, in do_egg_install
    self.run_command('bdist_egg')
  File "/usr/local/lib/python2.7/distutils/cmd.py", line 326, in run_command
    self.distribution.run_command(command)
  File "/usr/local/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/home/rohan/setuptools-0.6c11/setuptools/command/bdist_egg.py", line 236, in run
    dry_run=self.dry_run, mode=self.gen_header())
  File "/home/rohan/setuptools-0.6c11/setuptools/command/bdist_egg.py", line 527, in make_zipfile
    z = zipfile.ZipFile(zip_filename, mode, compression=compression)
  File "/usr/local/lib/python2.7/zipfile.py", line 651, in __init__
    "Compression requires the (missing) zlib module"
RuntimeError: Compression requires the (missing) zlib module

Auch wenn ich verwenden Setuptools 2.7 .egg versuchen, es gibt diesen Fehler:

Traceback (most recent call last):
File "<string>", line 1, in <module>
zipimport.ZipImportError: can't decompress data; zlib not available
War es hilfreich?

Lösung

vergessen Sie zlib1g-dev zu installieren, bevor Python zu bauen.

Andere Tipps

Installieren Sie zuerst die companents mit dem folgenden Befehl:

yum install zlib
yum install zlib-devel

dann Remake Python

make
make install

Bitte installieren Sie diese, bevor Sie fortfahren.

sudo apt-get install -y make build-essential libssl-dev zlib1g-dev libbz2-dev\
libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev

Pyenv - Gemeinsame Probleme mit dem Build

Meine Lösung für dieses Problem ist etwas anders, nur weil ich versuche, Python auf einem Remote-Computer zu installieren, die ich nicht zugreifen kann als Root-Benutzer und keinen Zugang zum Internet hat. Hier ist meine leicht modifizierte Lösung:

  1. Extract Python (dh: tar -xzf Python-3.6.4.tgz)
  2. ein Verzeichnis Sprechen Sie den lokalen Python zu beherbergen (zB: mkdir localpy)
  3. Navigieren in die Module / zlib-Ordner in dem extrahierten Python-Verzeichnis (zB: cd ./Python-3.6.4/Modules/zlib)
  4. Konfigurieren zlib lokal (dh: configure prefix = '/ usr / h / Prüfung / localpy')
  5. Erstellen und Installieren von zlib (make install)
  6. Naviage zurück zum extrahierter Python Ordner (zB: cd ../../)
  7. Configure Python lokal und zeigen auf zlib (dh: configure prefix = '/ usr / h / Prüf- / localpy' --with-zlib = '/ usr / h / Prüf- / localpy')
  8. Make Python (zB: make)
  9. Installieren Python (dh: make install)

Das kann nicht Arbeit für alle, aber es funktionierte für mich heute.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top