通过WSL在windows中安装bowtie2等生物信息学软件包

2024-09-26 17:57:00 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试用python开发一个GUI,用于分析可以在Linux和Windows中运行的tRNA Seq数据。为此,需要运行一些程序,如:bowtie2、samtools或bedtools,anaconda可以在Linux上轻松下载这些程序,但在Windows上却让人头疼。这个程序无法在Windows上下载,所以我必须安装Windows 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:command not found),但我可以运行wsl conda.exe而没有任何问题

你知道我做错了什么,或者我该怎么解决这个问题吗

多谢各位


Tags: installthe程序oslinuxwindowsshanaconda
2条回答

使用Linux anaconda安装程序为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

以下是您可以遵循的步骤

  1. 你必须安装Ubuntu终端。如果没有,请从Microsoft应用商店下载
  2. 安装Ubuntu后,使用命令sudo apt install wget安装wget
  3. 安装miniconda,因为miniconda是anaconda的较轻版本,将节省大量空间
  4. 下载miniconda安装程序。 wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
  5. 安装minicondabash Miniconda3-latest-Linux-x86_64.sh
  6. 导出路径export PATH=~/miniconda3/bin:$PATH
  7. 使用bioconda通道安装bowtie2 conda install -c bioconda bowtie2

相关问题 更多 >

    热门问题