PS E:\python\project> pip install mnnpy WARNING: Ignoring invalid distribution -ip (e:\python\project\venv\lib\site-packages) WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/mnnpy/ Collecting mnnpy Using cached mnnpy-0.1.9.5.tar.gz (117 kB) Preparing metadata (setup.py) ... done Requirement already satisfied: numpy in e:\python\project\venv\lib\site-packages (from mnnpy) (1.24.4) Requirement already satisfied: scipy in e:\python\project\venv\lib\site-packages (from mnnpy) (1.10.1) Requirement already satisfied: anndata in e:\python\project\venv\lib\site-packages (from mnnpy) (0.8.0) Requirement already satisfied: pandas in e:\python\project\venv\lib\site-packages (from mnnpy) (1.4.4) Requirement already satisfied: numba in e:\python\project\venv\lib\site-packages (from mnnpy) (0.58.1) Requirement already satisfied: h5py>=3 in e:\python\project\venv\lib\site-packages (from anndata->mnnpy) (3.10.0) Requirement already satisfied: natsort in e:\python\project\venv\lib\site-packages (from anndata->mnnpy) (8.4.0) Requirement already satisfied: packaging>=20 in e:\python\project\venv\lib\site-packages (from anndata->mnnpy) (24.0) Requirement already satisfied: python-dateutil>=2.8.1 in e:\python\project\venv\lib\site-packages (from pandas->mnnpy) (2.9.0.post0) Requirement already satisfied: pytz>=2020.1 in e:\python\project\venv\lib\site-packages (from pandas->mnnpy) (2024.1) Requirement already satisfied: llvmlite<0.42,>=0.41.0dev0 in e:\python\project\venv\lib\site-packages (from numba->mnnpy) (0.41.1) Requirement already satisfied: importlib-metadata in e:\python\project\venv\lib\site-packages (from numba->mnnpy) (7.1.0) Requirement already satisfied: six>=1.5 in e:\python\project\venv\lib\site-packages (from python-dateutil>=2.8.1->pandas->mnnpy) (1.16.0) Requirement already satisfied: zipp>=0.5 in e:\python\project\venv\lib\site-packages (from importlib-metadata->numba->mnnpy) (3.18.1) Building wheels for collected packages: mnnpy Building wheel for mnnpy (setup.py) ... error error: subprocess-exited-with-error × python setup.py bdist_wheel did not run successfully. │ exit code: 1 ╰─> [36 lines of output] Building with c. E:\python\project\venv\lib\site-packages\setuptools\dist.py:452: SetuptoolsDeprecationWarning: Invalid dash-separated options !! ******************************************************************************** Usage of dash-separated 'python-tag' will not be supported in future versions. Please use the underscore name 'python_tag' instead. This deprecation is overdue, please update your project and remove deprecated calls to avoid build errors in the future. See https://setuptools.pypa.io/en/latest/userguide/declarative_config.html for details. ******************************************************************************** !! opt = self.warn_dash_deprecation(opt, section) running bdist_wheel running build running build_py file irlb.py (for module irlb) not found file mnn.py (for module mnn) not found file utils.py (for module utils) not found creating build creating build\lib.win-amd64-cpython-38 creating build\lib.win-amd64-cpython-38\mnnpy copying mnnpy\irlb.py -> build\lib.win-amd64-cpython-38\mnnpy copying mnnpy\mnn.py -> build\lib.win-amd64-cpython-38\mnnpy copying mnnpy\settings.py -> build\lib.win-amd64-cpython-38\mnnpy copying mnnpy\utils.py -> build\lib.win-amd64-cpython-38\mnnpy copying mnnpy\__init__.py -> build\lib.win-amd64-cpython-38\mnnpy file irlb.py (for module irlb) not found file mnn.py (for module mnn) not found file utils.py (for module utils) not found running build_ext building 'mnnpy._utils' extension error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/ [end of output] note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for mnnpy Running setup.py clean for mnnpy Failed to build mnnpy ERROR: Failed to build installable wheels for some pyproject.toml based projects (mnnpy) PS E:\python\project> mnnpy下载不了
时间: 2025-06-06 21:14:35 浏览: 42
### 解决 mnnpy 在 Windows 上安装失败的问题
在 Windows 系统上安装 `mnnpy` 时,如果遇到“Microsoft Visual C++ 14.0 或更高版本缺失”的错误,可以通过以下方法解决:
#### 1. 安装 Microsoft C++ Build Tools
此问题的根本原因是缺少编译工具链。为了解决这个问题,可以直接安装 **Microsoft C++ Build Tools**,而无需安装完整的 Visual Studio[^4]。
- 访问微软官方下载页面:[Microsoft C++ Build Tools](https://visualstudio.microsoft.com/visual-cpp-build-tools/)。
- 登录微软账户后,在下载页面搜索“build tools”。
- 找到并选择左侧的 **Visual Studio 2015 Update 3**。
- 下载对应的 ISO 文件(约 1.1GB),并将下载目标格式设置为 DVD。
- 下载完成后,使用 Windows 文件管理器打开 ISO 文件,或解压后运行其中的可执行程序 `VisualCppBuildTools_Full.exe`。
- 按照提示完成安装。
#### 2. 使用预编译的二进制文件
如果安装编译工具仍然无法解决问题,可以尝试使用预编译的二进制文件。对于某些依赖包(如 `mnnpy` 的依赖项),可以使用 [Unofficial Windows Binaries for Python Extension Packages](https://www.lfd.uci.edu/~gohlke/pythonlibs/) 提供的 wheel 文件[^4]。
- 访问上述链接,搜索所需的包(如 `rpy2` 或其他依赖项)。
- 下载与 Python 版本和系统架构匹配的 `.whl` 文件。
- 使用以下命令安装:
```bash
pip install path_to_downloaded_whl_file.whl
```
#### 3. 配置 R 和 Bioconductor
由于 `mnnpy` 调用了 R 的 `BiocNeighbors` 包,因此需要确保 R 和 Bioconductor 已正确安装。
- 安装 R:从 [CRAN](https://cran.r-project.org/) 下载并安装最新版本的 R。
- 安装 Bioconductor 包:
```R
if (!requireNamespace("BiocManager", quietly = TRUE))
install.packages("BiocManager")
BiocManager::install(c("BiocNeighbors", "Batchelor"))
```
#### 4. 创建 Conda 环境
为了减少依赖冲突,建议在 Conda 环境中安装 `mnnpy` 及其依赖项。
- 创建一个新的 Conda 环境:
```bash
conda create -n mnnpy_env python=3.8
conda activate mnnpy_env
```
- 安装必要的依赖项:
```bash
conda install numpy scipy pandas anndata loompy rpy2
```
- 最后安装 `mnnpy`:
```bash
pip install mnnpy
```
#### 5. 检查环境变量
确保系统环境变量中包含 R 的路径。如果未正确配置,可能会导致 `rpy2` 无法找到 R 的库文件。
- 将 R 的安装路径添加到系统的 `PATH` 环境变量中。例如,如果 R 安装在 `C:\Program Files\R\R-4.2.0\bin`,则需要将该路径添加到 `PATH` 中。
---
### 示例代码验证安装
完成上述步骤后,可以运行以下代码以验证 `mnnpy` 是否成功安装:
```python
import mnnpy
print("mnnpy installed successfully!")
```
如果未出现任何错误,则表示安装成功。
---
### 注意事项
- 如果仍遇到问题,请检查 Python 和 R 的版本是否兼容[^3]。
- 确保所有依赖项均已正确安装,特别是 `rpy2` 和 R 的 Bioconductor 包。
---
阅读全文
相关推荐



















