Windows系统下Python的dlib安装失败求助(已装Anaconda、Cmake)
Hey there, sorry to hear you're stuck trying to install dlib 19.4 via Conda! Let's work through some common fixes that should get this sorted out for you.
First, update your Conda installation
Outdated Conda versions often cause weird package resolution or dependency conflicts. Run these commands first to make sure everything's up to date:conda update -n base -c defaults conda conda update --allOnce that's done, try re-running your original install command:
conda install -c conda-forge dlib=19.4Force Conda to prioritize the conda-forge channel
Sometimes Conda's default channel priority might prevent it from finding the specific dlib version you want. You can temporarily override channels to force it to use conda-forge exclusively for this install:conda install -c conda-forge --override-channels dlib=19.4If you regularly use conda-forge packages, you can also set it as the strict priority channel permanently (this helps avoid similar issues in the future):
conda config --add channels conda-forge conda config --set channel_priority strictCheck Python version compatibility
dlib 19.4 is an older version, so it might not support newer Python releases (like 3.9+). First, check your current Python version:python --versionIf your version is too new, create a dedicated virtual environment with a compatible Python version (3.7 or 3.8 usually works for dlib 19.4) and try installing there:
conda create -n dlib_env python=3.7 conda activate dlib_env conda install -c conda-forge dlib=19.4Fallback: Install from source with pip
Since you already have CMake installed, compiling dlib from source via pip is a reliable fallback. Just make sure you have a C++ compiler set up (on Windows, install Visual Studio Build Tools and select the "Desktop development with C++" workload). Then run:pip install dlib==19.4Note: Compiling can take a few minutes, so be patient and keep your network connection stable.
内容的提问来源于stack exchange,提问作者Pavel Vorobyov

