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

Windows11虚拟环境中Pip无法找到Boost,安装vina失败如何解决?

解决Windows下Conda虚拟环境安装vina时Boost库找不到的问题

问题回顾

在Windows的Conda虚拟环境中执行pip install vina时,出现报错:

error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> [63 lines of output]
fatal: not a git repository (or any of the parent directories): .git
Version found 1.2.5 (from init.py)
running egg_info
creating vina.egg-info
writing vina.egg-info\PKG-INFO
writing dependency_links to vina.egg-info\dependency_links.txt
writing requirements to vina.egg-info\requires.txt
writing top-level names to vina.egg-info\top_level.txt
writing manifest file 'vina.egg-info\SOURCES.txt'
Boost library is not installed in this conda environment.

已通过mamba install -c conda-forge numpy swig boost-cpp sphinx sphinx_rtd_theme安装依赖,且系统已安装boost_1_82并添加至PATH,但johnnydep vina仍提示Boost library location was not found!。


解决方案

方案1:直接安装Conda预编译包(推荐)

Conda-Forge提供了预编译好的vina包,无需手动处理编译依赖,直接执行:

conda activate your_env_name
mamba install -c conda-forge vina

此方法完全避开编译环节,是Windows环境下最省心的方案。

方案2:手动指定Boost环境变量后用pip安装

如果必须用pip安装,需要明确告诉编译脚本Conda环境中Boost的位置:

  1. 激活你的Conda虚拟环境:
    conda activate your_env_name
    
  2. 设置Boost相关环境变量(Conda环境中boost-cpp默认安装在%CONDA_PREFIX%\Library下):
    set BOOST_INCLUDEDIR=%CONDA_PREFIX%\Library\include
    set BOOST_LIBRARYDIR=%CONDA_PREFIX%\Library\lib
    
  3. 执行pip安装:
    pip install vina
    

方案3:修改vina源码的setup.py适配Windows路径

如果上述方案无效,可手动调整vina的编译检测逻辑:

  1. 下载vina源码:
    git clone https://github.com/ccsb-scripps/AutoDock-Vina.git
    cd AutoDock-Vina
    
  2. 编辑setup.py,找到检测Boost的代码段,替换为以下内容(强制使用Conda环境的Boost路径):
    import os
    # 优先从环境变量取,否则用Conda默认路径
    boost_include_dir = os.environ.get('BOOST_INCLUDEDIR', os.path.join(os.environ['CONDA_PREFIX'], 'Library', 'include'))
    boost_lib_dir = os.environ.get('BOOST_LIBRARYDIR', os.path.join(os.environ['CONDA_PREFIX'], 'Library', 'lib'))
    
    # 后续编译时直接使用上述路径
    
  3. 在激活环境后执行本地安装:
    pip install .
    

问题原因

Windows下pip安装vina需要本地编译,但vina的官方setup脚本对Conda环境的Boost路径识别逻辑不完善——Conda环境中的boost-cpp安装在%CONDA_PREFIX%\Library下,而脚本默认会去系统标准路径查找,导致找不到依赖。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.24 22:52:15