Travis CI抛出语法错误

时间:2016-02-24 18:28:23

标签: python django travis-ci

我正在尝试用Travis构建一个Django项目 我的版本继续显示以下错误

Processing triggers for libc-bin ...
ldconfig deferred processing now taking place
/home/travis/build.sh: line 298: syntax error in conditional expression
/home/travis/build.sh: line 298: syntax error near `2.7/bin/activate'
/home/travis/build.sh: line 298: `if [[ ! -f ~/virtualenv/python– 2.7/bin/activate ]]; then'

这是我的.travis.yml文件:

language: python
services:
  – mysql
python:
  – 2.7
env:
  - DJANGO=1.9.2

before_install:
  - export DJANGO_SETTINGS_MODULE=happny.settings.travis
install:
  – pip install -r requirements/test.txt

before_script:
  – python manage.py makemigrations
  – python manage.py migrate
script:
  – python manage.py test
branches:
  only:
    - master

2 个答案:

答案 0 :(得分:2)

问题是yaml文件中的破折号( - )字符。从网页复制导致格式不匹配

我注意到短划线的长度比平时长。我通过手动重新输入.travis.yml文件来修复它。

答案 1 :(得分:-1)

尝试在""

中包装python版本
python:
  - "2.7"