Travis CI python导入do n

2024-05-15 08:36:46 发布

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

在我的项目中,我对travisci的测试脚本有问题。我使用conda安装了我需要的包,然后运行了我的测试脚本。由于导入错误,生成失败。我该怎么解决这个问题?在

我的travis YAML文件如下:

language: python
python:
  - "2.7"
  - "3.4"
  - "nightly"

# command to install dependencies
# setup anaconda
before_install:
  - wget http://repo.continuum.io/miniconda/Miniconda-latest-Linux-x86_64.sh -O miniconda.sh
  - chmod +x miniconda.sh
  - bash miniconda.sh -b -p $HOME/miniconda
  - export PATH="$HOME/miniconda/bin:$PATH"
  - conda update -y conda

# install packages
install:
  - conda install -y numpy scipy matplotlib networkx biopython
  - echo $PATH
  - which python


# command to run tests
script: py.test

我的一个测试脚本需要BioPython,但是测试脚本失败了,因为它找不到BioPython。在

^{pr2}$

有办法解决这个问题吗?在


Tags: installtopath项目脚本travisyamlhome
1条回答
网友
1楼 · 发布于 2024-05-15 08:36:46

原来问题是py.test-我没有在conda环境中安装它。在创建新环境时,将pytest添加到要安装的包中,可以消除这些导入错误。在

相关问题 更多 >