我正在尝试用 python 开发一个 GUI 来分析 tRNA-Seq 数据,该数据可以在 Linux 和 Windows 中运行。为此,需要运行一些程序,例如: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 安装程序来安装 anaconda for wsl2
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 安装所需的软件。
希望这对您有帮助。欲了解更多信息,请访问此 帖子
以下是您可以遵循的步骤。
sudo apt install wget
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
bash Miniconda3-latest-Linux-x86_64.sh
export PATH=~/miniconda3/bin:$PATH
conda install -c bioconda bowtie2
仅供参考:它在 debian/ubuntu 上:
sudo apt update
sudo apt install bowtie2
(也在酿造中)。