pyinstaller 打包错误,OSError: Python library not found:,,


24 INFO: PyInstaller: 3.2.1
25 INFO: Python: 3.4.1
25 INFO: Platform: Linux-2.6.32-220.el6.x86_64-x86_64-with-centos-6.2-Final
26 INFO: wrote /home/fmwei/src/lxa.spec
27 INFO: UPX is not available.
29 INFO: Extending PYTHONPATH with paths
['/home/fmwei/src', '/home/fmwei/src']
29 INFO: checking Analysis
29 INFO: Building Analysis because out00-Analysis.toc is non existent
29 INFO: Initializing module dependency graph...
30 INFO: Initializing module graph hooks...
31 INFO: Analyzing ...
1023 INFO: Processing pre-find module path hook   distutils
1814 INFO: running Analysis out00-Analysis.toc
1821 INFO: Caching module hooks...
1825 INFO: Analyzing /home/fmwei/src/
1861 INFO: Loading module hooks...
1861 INFO: Loading module hook ""...
1906 INFO: Loading module hook ""...
1906 INFO: Loading module hook ""...
2048 INFO: Loading module hook ""...
2058 INFO: Looking for ctypes DLLs
2058 INFO: Analyzing run-time hooks ...
2066 INFO: Looking for dynamic libraries
2353 INFO: Looking for eggs
2353 INFO: Python library not in binary depedencies. Doing additional searching...
Traceback (most recent call last):
  File "/usr/local/python34/bin/pyinstaller", line 9, in <module>
    load_entry_point('PyInstaller==3.2.1', 'console_scripts', 'pyinstaller')()
  File "/usr/local/python34/lib/python3.4/site-packages/PyInstaller/", line 90, in run
    run_build(pyi_config, spec_file, **vars(args))
  File "/usr/local/python34/lib/python3.4/site-packages/PyInstaller/", line 46, in run_build
    PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
  File "/usr/local/python34/lib/python3.4/site-packages/PyInstaller/building/", line 788, in main
    build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
  File "/usr/local/python34/lib/python3.4/site-packages/PyInstaller/building/", line 734, in build
    exec(text, spec_namespace)
  File "<string>", line 16, in <module>
  File "/usr/local/python34/lib/python3.4/site-packages/PyInstaller/building/", line 212, in __init__
  File "/usr/local/python34/lib/python3.4/site-packages/PyInstaller/building/", line 161, in __postinit__
  File "/usr/local/python34/lib/python3.4/site-packages/PyInstaller/building/", line 543, in assemble
  File "/usr/local/python34/lib/python3.4/site-packages/PyInstaller/building/", line 626, in _check_python_library
    raise IOError(msg)
OSError: Python library not found:,,
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)

大概意思就是pyinstaller报错找不到python动态库,也提示说升级python-dev。因为我是centos,各种yum install python-develyum install python-dev都不行,什么升级/重装python、sudo、su甚至重装系统都不行!!!我又必须在centos6.2环境下编译,如果我在其他高版本的环境下打包后拿到centos6.2就会报错,言归正传!其实处理起来很简单。只需要复制python安装目录下的动态库到系统地动态库目录即可。
cp -R /usr/local/python3.4/lib/* /usr/lib64/ 这样就搞定了!

标签:, pyinstaller,