web-dev-qa-db-fra.com

erreur pyinstaller: OSError: Python introuvable: libpython3.4mu.so.1.0, libpython3.4m.so.1.0, libpython3.4.so.1.0

J'utilise Python 3.4.4 sur Centos7.

J'ai créé un programme python sur ma machine locale qui utilise des modules qt. Le programme fonctionne correctement sur ma machine locale. J'essaie maintenant de créer un exécutable avec pyinstaller. I utilise la commande:

pyinstaller main.py

J'obtiens la sortie suivante:

40 INFO: PyInstaller: 3.2.1
40 INFO: Python: 3.4.4
41 INFO: Platform: Linux-3.10.0-327.36.3.el7.x86_64-x86_64-with-centos-7.3.1611-Core
41 INFO: wrote /home/neilharris/Documents/Python_Projects/transcoder/main.spec
42 INFO: UPX is not available.
44 INFO: Extending PYTHONPATH with paths
['/home/neilharris/Documents/Python_Projects/transcoder',
 '/home/neilharris/Documents/Python_Projects/transcoder']
44 INFO: checking Analysis
44 INFO: Building Analysis because out00-Analysis.toc is non existent
44 INFO: Initializing module dependency graph...
45 INFO: Initializing module graph hooks...
47 INFO: Analyzing base_library.Zip ...
1869 INFO: Processing pre-find module path hook   distutils
3030 INFO: running Analysis out00-Analysis.toc
3039 INFO: Caching module hooks...
3046 INFO: Analyzing /home/neilharris/Documents/Python_Projects/transcoder/main.py
3089 INFO: Loading module hooks...
3089 INFO: Loading module hook "hook-xml.py"...
3353 INFO: Loading module hook "hook-encodings.py"...
3437 INFO: Loading module hook "hook-PyQt4.py"...
3438 INFO: Loading module hook "hook-distutils.py"...
3440 INFO: Loading module hook "hook-PyQt4.QtCore.py"...
3575 INFO: Loading module hook "hook-pydoc.py"...
3576 INFO: Loading module hook "hook-PyQt4.QtGui.py"...
3849 INFO: Looking for ctypes DLLs
3861 INFO: Analyzing run-time hooks ...
3867 INFO: Including run-time hook 'pyi_rth_qt4plugins.py'
3877 INFO: Looking for dynamic libraries
ldd: warning: you do not have execution permission for `/usr/local/lib/python3.4/site-packages/PyQt4/QtGui.so'
ldd: warning: you do not have execution permission for `/usr/local/lib/python3.4/site-packages/PyQt4/QtCore.so'
5115 INFO: Looking for eggs
5115 INFO: Python library not in binary depedencies. Doing additional searching...
Traceback (most recent call last):
  File "/usr/local/bin/pyinstaller", line 9, in <module>
    load_entry_point('PyInstaller==3.2.1', 'console_scripts', 'pyinstaller')()
  File "/usr/local/lib/python3.4/site-packages/PyInstaller/__main__.py", line 90, in run
    run_build(pyi_config, spec_file, **vars(args))
  File "/usr/local/lib/python3.4/site-packages/PyInstaller/__main__.py", line 46, in run_build
    PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
  File "/usr/local/lib/python3.4/site-packages/PyInstaller/building/build_main.py", line 788, in main
    build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
  File "/usr/local/lib/python3.4/site-packages/PyInstaller/building/build_main.py", line 734, in build
    exec(text, spec_namespace)
  File "<string>", line 16, in <module>
  File "/usr/local/lib/python3.4/site-packages/PyInstaller/building/build_main.py", line 212, in __init__
    self.__postinit__()
  File "/usr/local/lib/python3.4/site-packages/PyInstaller/building/datastruct.py", line 161, in __postinit__
    self.assemble()
  File "/usr/local/lib/python3.4/site-packages/PyInstaller/building/build_main.py", line 543, in assemble
    self._check_python_library(self.binaries)
  File "/usr/local/lib/python3.4/site-packages/PyInstaller/building/build_main.py", line 626, in _check_python_library
    raise IOError(msg)
OSError: Python library not found: libpython3.4m.so.1.0, libpython3.4mu.so.1.0, libpython3.4.so.1.0
This would mean your Python installation doesn't come with proper library files.
This usually happens by missing development package, or unsuitable build parameters of Python installation.

* On Debian/Ubuntu, you would need to install Python development packages
  * apt-get install python3-dev
  * apt-get install python-dev
* If you're building Python by yourself, please rebuild your Python with `--enable-shared` (or, `--enable-framework` on Darwin)

Quelqu'un sait-il quel pourrait être le problème? Juste pour dire que j'ai python3-devel et python-devel installés (par rapport à la suggestion à la fin de la sortie imprimée.) Merci

13
neilH

J'ai résolu cela de la manière suivante:

1er. vérifiez votre système s'il contient libpython3.4m.so.1.0. Si oui, passez à l'étape 2. Si non, téléchargez-le (j'utilise python anaconda, donc je l'ai dans le dossier anaconda.)

2e. Sudo cp /folder/to/your/libpython3.4m.so.1.0 /usr/lib

1
Chengxing Zhang

Vous devez installer python-dev pour la version de votre python

par exemple:

Debian/Ubuntu - Python 2.7 ---> python2.7-dev

CentOs/RedHat - Python 3.4 ---> python34-devel

CentOs/RedHat - Python 2.7 ---> python27-devel

Cependant, une de ces erreurs peut être déroutante: IOError ("Bibliothèque Python introuvable!") PyInstaller doit regrouper la bibliothèque Python, qui est la partie principale de Python, lié en tant que bibliothèque de chargement dynamique. Le nom et l'emplacement de ce fichier varient en fonction de la plate-forme utilisée. Certaines installations Python n'incluent pas un Python par défaut (une bibliothèque liée statiquement peut être présente mais ne peut pas être utilisée). Vous devrez peut-être installer un package de développement quelconque. Ou bien, la bibliothèque peut exister mais ne se trouve pas dans un dossier où PyInstaller est recherche.

Les emplacements où PyInstaller recherche la bibliothèque python sont différents dans les différents systèmes d'exploitation, mais/lib et/usr/lib sont vérifiés dans la plupart des systèmes. Si vous ne pouvez pas mettre le python bibliothèque là-bas, essayez de définir le chemin d'accès correct dans la variable d'environnement LD_LIBRARY_PATH sous Linux ou DYLD_LIBRARY_PATH sous OS X.

Référence

0
RaminNietzsche