centos6.8使用pyinstaller异常解决记录

执行:

pyinstaller -F test.py

提示:

Traceback (most recent call last):
  File "/usr/local/bin/pyinstaller", line 9, in 
    load_entry_point('PyInstaller==3.4', 'console_scripts', 'pyinstaller')()
  File "/usr/local/lib/python3.5/site-packages/PyInstaller/__main__.py", line 111, in run
    run_build(pyi_config, spec_file, **vars(args))
  File "/usr/local/lib/python3.5/site-packages/PyInstaller/__main__.py", line 63, in run_build
    PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
  File "/usr/local/lib/python3.5/site-packages/PyInstaller/building/build_main.py", line 838, in main
    build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
  File "/usr/local/lib/python3.5/site-packages/PyInstaller/building/build_main.py", line 784, in build
    exec(text, spec_namespace)
  File "", line 17, in 
  File "/usr/local/lib/python3.5/site-packages/PyInstaller/building/build_main.py", line 241, in __init__
    self.__postinit__()
  File "/usr/local/lib/python3.5/site-packages/PyInstaller/building/datastruct.py", line 158, in __postinit__
    self.assemble()
  File "/usr/local/lib/python3.5/site-packages/PyInstaller/building/build_main.py", line 573, in assemble
    self._check_python_library(self.binaries)
  File "/usr/local/lib/python3.5/site-packages/PyInstaller/building/build_main.py", line 676, in _check_python_library
    raise IOError(msg)
OSError: Python library not found: libpython3.5.so.1.0, libpython3.5mu.so.1.0, libpython3.5m.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.

原因:找不到python lib动态库 

解决:

1、执行python --version查看当前版本,并查找/usr/local/lib 下有没有对应版本的libpython*.*.so文件,

2、没有该文件--->> 重新安装python

3、重新安装python:

 

  1. yum groupinstall "Development Tools"  ## 安装依赖
  2. 下载地址:https://www.python.org/ftp/python/
  3. mv Python-3.5.2.tgz /opt/module
  4. tar zxvf Python-3.5.2.tgz
  5. cd Python-3.5.2
  6. ./configure --prefix=/usr/local/python35
  7. make && make install

此时,终端执行python3异常:

python3.5: error while loading shared libraries: libpython3.5m.so.1.0: cannot open shared object file: No such file or directory

执行pip3 list 异常:

/usr/local/bin/python3.5: error while loading shared libraries: libpython3.5m.so.1.0: cannot open shared object file: No such file or directory

解决:指定libpython3.5m.so.1.0的路径

4、添加库配置信息

  1. 拷贝安装文件下的libpython3.5m.so.1.0到/usr/local/lib下
  2. cd  /etc/ld.so.conf.d
  3. vim python3.conf
  4. 添加库文件路径 /usr/local/lib,保存退出
  5. ldconfig

5、添加软连接

cd /usr/bin
#创建python3.5版本的软连接
ln -s /usr/python3.5/bin/python3 /usr/bin/python3

 

 

 

 

 

 

 

 

 

 

 

 

你可能感兴趣的:(python)