sys.exit(run()) File "/usr/local/python374/..._pyinstaller.exceptions.pythonlibrarynotfounderror: python library not">
赞
踩
想使用pyinstaller隐藏代码部署时 ,遇到报错
具体报错如下:
- Traceback (most recent call last):
- File "/usr/local/python374/bin/pyinstaller", line 10, in <module>
- sys.exit(run())
- File "/usr/local/python374/lib/python3.7/site-packages/PyInstaller/__main__.py", line 111, in run
- run_build(pyi_config, spec_file, **vars(args))
- File "/usr/local/python374/lib/python3.7/site-packages/PyInstaller/__main__.py", line 63, in run_build
- PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
- File "/usr/local/python374/lib/python3.7/site-packages/PyInstaller/building/build_main.py", line 844, in main
- build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
- File "/usr/local/python374/lib/python3.7/site-packages/PyInstaller/building/build_main.py", line 791, in build
- exec(code, spec_namespace)
- File "/run/projects/simulate_area/bi_for_/console_.spec", line 17, in <module>
- noarchive=False)
- File "/usr/local/python374/lib/python3.7/site-packages/PyInstaller/building/build_main.py", line 243, in __init__
- self.__postinit__()
- File "/usr/local/python374/lib/python3.7/site-packages/PyInstaller/building/datastruct.py", line 158, in __postinit__
- self.assemble()
- File "/usr/local/python374/lib/python3.7/site-packages/PyInstaller/building/build_main.py", line 575, in assemble
- self._check_python_library(self.binaries)
- File "/usr/local/python374/lib/python3.7/site-packages/PyInstaller/building/build_main.py", line 681, in _check_python_library
- raise IOError(msg)
- OSError: Python library not found: libpython3.7m.so.1.0, libpython3.7.so.1.0, libpython3.7m.so, libpython3.7mu.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)

于是先安装 python3-devel,
yum install python3-devel
完成后仍然报错,我是自己编译的python,于是尝试重新编译:
- rm -rf Python-3.7.4
- tar -xzf Python-3.7.4.tgz
- cd Python-3.7.4
- ./configure --prefix=/usr/local/python374 --enable-optimizations --with-openssl=/usr/local/openssl --enable-shared
- make && make install
开启--enable-shared后会报 找不到so的错误 解决如下:
- echo "/usr/local/python374/lib/" >> /etc/ld.so.conf
- ldconfig
之后再使用pyinstaller console_.py ok
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。