如何解决通过 WSL 在 windows 中安装像 bowtie2 这样的生物信息学包
我正在尝试在 python 中开发一个 GUI,用于分析可以在 Linux 和 Windows 中运行的 tRNA-Seq 数据。为此,需要运行一些程序,例如:bowtie2、samtools 或 bedtools,它们可以在 Linux 上通过 anaconda 轻松下载,但在 Windows 上则令人头疼。该程序无法在Windows上下载,所以我不得不安装Windows Subsystem for Linux (WSL)并尝试通过这种方式下载。
我为此开发了以下 python 脚本 (anaconda_setup.py):
import os
#Download the file for Linux,altough this script will run only on Windows Subsystem for Linux
os.system('curl -O https://repo.anaconda.com/archive/Anaconda3-2020.07-Linux-x86_64.sh')
#Checking the integrity of the file
os.system('sha256sum Anaconda3-2020.07-Linux-x86_64.sh')
#Running the .sh script
os.system('bash Anaconda3-2020.07-Linux-x86_64.sh')
#Compiling from source
os.system('source ~/.bashrc')
os.system('Anaconda3-2020.07-Linux-x86_64.sh')
#Using conda to install bowtie2,samtools and bedtools
os.system('conda install -c bioconda bowtie2')
os.system('conda install -c bioconda samtools')
os.system('conda install -c bioconda bedtools')
import os
...
os.system("wsl python3 anaconda_setup.py")
此 anaconda 已正确安装,但我不确定它是安装在 Windows 上还是 WSL 中。但我得到了下一个错误:
sh: 1: 来源:未找到 sh: 1: conda: 未找到 sh: 1: conda: 未找到 sh: 1: conda: 未找到
另一方面,我已经从 CMD 进入 WSL,我可以手动运行 conda.exe 和 conda,但我无法以自动方式运行。此外,从 CMD 我无法运行:“wsl conda”(错误:/bin/bash:conda:未找到命令)但我可以毫无问题地运行 wsl conda.exe。
知道我做错了什么或如何解决这个问题吗?
非常感谢。
解决方法
使用 anaconda 的 Linux 安装程序为 wsl2 安装 anaconda
wget https://repo.anaconda.com/miniconda/Miniconda3-py39_4.9.2-Linux-x86_64.sh
检查conda
命令是否运行,如果没有,必须将路径导出到.bashrc
文件中
export PATH=/home/user/anaconda3/bin:$PATH
再次运行 conda
,它现在可以工作了。您可以在 wsl2 中使用 conda 安装所需的软件。
希望能帮到你。有关更多信息,请访问此 post
,以下是您可以遵循的步骤。
- 您必须安装 Ubuntu 终端。如果不是从 Microsoft Store 下载。
- 安装 Ubuntu 后使用命令
sudo apt install wget
安装 wget - 安装 miniconda,因为 miniconda 是 anaconda 的轻量级版本,可以节省大量空间。
- 下载 miniconda 安装程序。
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
- 安装 miniconda
bash Miniconda3-latest-Linux-x86_64.sh
- 导出路径
export PATH=~/miniconda3/bin:$PATH
- 使用 bioconda 通道安装 bowtie2
conda install -c bioconda bowtie2
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。