我有一个包,它有 scipy 作为依赖项。我已经知道安装 scipy throughapt-get
会给我们一个过时的软件包版本,并且安装它会pip
导致 Travis VM 超时,所以我决定在测试期间下载并安装 Miniconda,就像许多其他问题中所建议的那样。
但是,每当我推送到 GitHub 并且 Travis 运行我的单元测试时,它都找不到scipy
包。错误信息很简单ImportError: No module named 'scipy'
。
这是我的.travis.yml
文件的内容。python --version
正确指向“Python 3.4.4 :: Continuum Analytics, Inc.” 并conda list
显示已安装 scipy 0.17.0。如果有人感兴趣,这里是我的 Travis build 的完整日志。
language: python
python:
# We don't actually use the Travis Python, but this keeps it organized.
- "3.4"
install:
- sudo apt-get update
# We do this conditionally because it saves us some downloading if the
# version is the same.
- if [[ "$TRAVIS_PYTHON_VERSION" == "2.7" ]]; then
wget https://repo.continuum.io/miniconda/Miniconda-latest-Linux-x86_64.sh -O miniconda.sh;
else
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh;
fi
- bash miniconda.sh -b -p $HOME/miniconda
- export PATH="$HOME/miniconda/bin:$PATH"
- hash -r
- conda config --set always_yes yes --set changeps1 no
- conda update -q conda
# Useful for debugging any issues with conda
- conda info -a
- conda create -q -n test-environment python=$TRAVIS_PYTHON_VERSION numpy scipy scikit-learn matplotlib
- source activate test-environment
- conda list
- python --version
- whereis python
- python setup.py install
script: nosetests