You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

手动删除Qt目录后qmake无法读取配置文件的求助

Fixing qmake's Double Slash Path Error After Qt Reinstallation

Let's break down what's happening here and work through the fix step by step:

Why the Double Slash?

That odd // in the path comes from a misconfiguration in qtchooser—chances are one of its config files has a path ending with a trailing slash. When qtchooser tries to stitch paths together, that extra slash combines with the next segment to create the double slash issue. Even though your default.conf exists in the correct (no-double-slash) path, qmake is pulling the broken path from qtchooser's settings.

Step 1: Find the Problematic Config File

Qtchooser uses two common config locations—check both:

  • System-wide config: /etc/xdg/qtchooser/default.conf
  • User-specific config: ~/.config/qtchooser/default.conf

Run this command to inspect both files at once:

cat /etc/xdg/qtchooser/default.conf ~/.config/qtchooser/default.conf 2>/dev/null

Look for lines that end with a slash (like /usr/lib/x86_64-linux-gnu/qt5/ instead of /usr/lib/x86_64-linux-gnu/qt5). That trailing slash is the culprit behind the double slash.

Step 2: Fix the Config File

Open the problematic file with a text editor (use sudo for the system-wide one):

sudo nano /etc/xdg/qtchooser/default.conf
# Or for user-specific: nano ~/.config/qtchooser/default.conf

Remove any trailing slashes from the paths inside. For example, change:

/usr/lib/x86_64-linux-gnu/qt5/
/usr/lib/x86_64-linux-gnu/qt5/bin/

To:

/usr/lib/x86_64-linux-gnu/qt5
/usr/lib/x86_64-linux-gnu/qt5/bin

Save the file (Ctrl+O in nano) and exit (Ctrl+X).

Step 3: Alternative: Reconfigure Qt via update-alternatives

If fixing the config file doesn't resolve things, you can reset the default Qt version using update-alternatives:

  1. List available qmake versions:
    update-alternatives --list qmake
    
  2. Set the correct Qt 5 version as default:
    sudo update-alternatives --config qmake
    

Follow the on-screen prompt to select your installed Qt 5 version.

Step 4: Verify the Fix

Run the command again to confirm it works:

qmake --version

It should now correctly locate the config file and display your Qt version without errors.

内容的提问来源于stack exchange,提问作者nilsiism

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.27 09:21:58