赞
踩
在写好程序后,程序按目录分配,分为bin,lib等,原本程序启动时会默认在程序当前文件夹下找库,找不到回去环境变量找。QT 则需要导入QT相关的动态库和一个QT_PLUGIN_PATH 的相对路径
windows下
1、将需要的库目录加入环境变量路径path中,在电脑高级系统设置里增加
2、设置一个QT_PLUGIN_PATH = 路径:Qt/plugins。
linux下。我使用的root用户
备份文件,注意这个文件不要随便更改,后面会导致linux 系统崩溃,开不了机 cp ~/.bashrc bashrc_system vim ~/.bashrc 末端增加 Root1=/opt/ptroot export LD_LIBRARY_PATH=$Root1/lib:$LD_LIBRARY_PATH export QT_PLUGIN_PATH=$Root1/lib/plugins #export PYTHONHOME=$Root1/python3.10.0 最后加载每次修改 source ~/.bashrc 总体演示 # .bashrc # Source global definitions if [ -f /etc/bashrc ]; then . /etc/bashrc fi # User specific environment if ! [[ "$PATH" =~ "$HOME/.local/bin:$HOME/bin:" ]] then PATH="$HOME/.local/bin:$HOME/bin:$PATH" fi export PATH # Uncomment the following line if you don't like systemctl's auto-paging feature: # export SYSTEMD_PAGER= # User specific aliases and functions alias rm='rm -i' alias cp='cp -i' alias mv='mv -i' Root1=/opt/ptroot export LD_LIBRARY_PATH=$Root1/lib:$LD_LIBRARY_PATH export QT_PLUGIN_PATH=$Root1/lib/plugins #export PYTHONHOME=$Root1/python3.10.0
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。