---
title: 编译安装
description: "1. 使用PuTTY工具，以root用户登录服务器。"
url: https://www.hikunpeng.com/document/detail/zh/kunpenghpcs/hpcindapp/prtg-osc/kunpengkb-python_02_0008.html
sourcePath: /source/zh/kunpenghpcs/hpcindapp/prtg-osc/kunpengkb-python_02_0008.html
indexId: 2649ef74d0916284ae337c740ecc0ae30ea1bec3b09eec014d7da4218558589671
---
# 编译安装

#### 操作步骤

1. 使用PuTTY工具，以root用户登录服务器。
2. 执行以下命令创建并启用kb_python的conda环境。

```
conda activate base
conda create -n kb
conda activate kb
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels conda-forge
conda config --set show_channel_urls yes
conda update -n base -c defaults conda
```


  “conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/”为可选。若通过conda安装软件时，网速较慢，可执行该命令添加国内conda源。

3. 执行以下命令安装Python环境。

```
conda install python=3.8
pip install Cython --trusted-host mirrors.tools.huawei.com -i http://mirrors.tools.huawei.com/pypi/simple
```


4. 执行以下命令安装PYSAM。

```
cd /home
git clone https://github.com/pysam-developers/pysam.git
cd pysam
yum install zlib-devel
yum install bzip2-devel
python setup.py install
```


5. 执行以下命令安装tables。

```
conda install h5py python-blosc
pip install tables
```


6. 执行以下命令安装kb-python。

```
cd
/home/kb_python
pip install -r requirements.txt
pip install -r dev-requirements.txt
python setup.py install
```


7. 执行以下命令验证kb-python。

```
kb info
```

显示如下信息，则表示kb-python安装成功：

  - 若返回“OSError: [Errno 8] Exec format error: '/root/anaconda3/envs/kb/lib/python3.8/site-packages/kb_python-0.26.4 -py3.8.egg/kb_python/bins/linux/kallisto/kallisto'”报错，则执行以下命令：

```
ln -sf /usr/local/bin/bustools /root/anaconda3/envs/kb/lib/python3.8/site-packages/kb_python-0.26.4-py3.8.egg/kb_python/bins/linux/bustools/bustools
```


  - 若返回“OSError: [Errno 8] Exec format error: '/root/anaconda3/envs/kb/lib/python3.8/site-packages/kb_python-0.26.4-py3.8.egg/kb_python/bins/linux/bustools/bustools'”报错，则执行以下命令：

```
ln -sf /usr/local/bin/kallisto /root/anaconda3/envs/kb/lib/python3.8/site-packages/kb_python-0.26.4-py3.8.egg/kb_python/bins/linux/kallisto/kallsto
```
