我有一个go项目,它有一个Python 3.4依赖项(外部命令)。我有一组名为reqs.txt
的要求。我使用virtualenv来确保我在自己的venv中,因此我可以安装我的依赖项。
我收到以下错误(以下完整日志):
ImportError: No module named 'six'
这令人沮丧,因为在此行之前,已安装了six
包。
sudo: required
language: go
go:
- 1.7
addons:
apt:
sources:
- deadsnakes # source required so it finds the package definition below
packages:
- python3.4
before_install:
- go get github.com/axw/gocov/gocov
- go get github.com/mattn/goveralls
- if ! go get code.google.com/p/go.tools/cmd/cover; then go get golang.org/x/tools/cmd/cover; fi
- sudo pip install virtualenv
- virtualenv -p `which python3.4` .venv
- source .venv/bin/activate
- python -V
- pip -V
- pip install -r cmd/refframes/reqs.txt
- wget -O cmd/refframes/spicekernels/de430.bsp https://naif.jpl.nasa.gov/pub/naif/generic_kernels/spk/planets/de430.bsp
script:
- python cmd/refframes/tests.py
- go test -v -timeout=30m -covermode=count -coverprofile=coverage.out
#- $HOME/gopath/bin/goveralls -coverprofile=coverage.out -service=travis-ci
- $HOME/gopath/bin/goveralls -package github.com/ChristopherRabotin/smd -service=travis-ci
$ pip install -r cmd/refframes/reqs.txt
You are using pip version 6.0.7, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Collecting appdirs==1.4.0 (from -r cmd/refframes/reqs.txt (line 1))
Downloading appdirs-1.4.0-py2.py3-none-any.whl
Collecting numpy==1.12.0 (from -r cmd/refframes/reqs.txt (line 2))
Downloading numpy-1.12.0.zip (4.8MB)
100% |################################| 4.8MB 127kB/s
Running from numpy source directory.
Collecting packaging==16.8 (from -r cmd/refframes/reqs.txt (line 3))
Downloading packaging-16.8-py2.py3-none-any.whl
Collecting py==1.4.32 (from -r cmd/refframes/reqs.txt (line 4))
Downloading py-1.4.32-py2.py3-none-any.whl (82kB)
100% |################################| 86kB 5.0MB/s
Collecting pyparsing==2.1.10 (from -r cmd/refframes/reqs.txt (line 5))
Downloading pyparsing-2.1.10-py2.py3-none-any.whl (56kB)
100% |################################| 57kB 6.5MB/s
Collecting pytest==3.0.6 (from -r cmd/refframes/reqs.txt (line 6))
Downloading pytest-3.0.6-py2.py3-none-any.whl (172kB)
100% |################################| 176kB 2.9MB/s
Collecting six==1.10.0 (from -r cmd/refframes/reqs.txt (line 7))
Downloading six-1.10.0-py2.py3-none-any.whl
Collecting spiceypy==1.1.0 (from -r cmd/refframes/reqs.txt (line 8))
Downloading spiceypy-1.1.0.tar.gz (213kB)
100% |################################| 217kB 2.4MB/s
Traceback (most recent call last):
File "<string>", line 20, in <module>
File "/tmp/pip-build-l48p479i/spiceypy/setup.py", line 5, in <module>
import getspice
File "/tmp/pip-build-l48p479i/spiceypy/getspice.py", line 13, in <module>
import six.moves.urllib as urllib
ImportError: No module named 'six'
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 20, in <module>
File "/tmp/pip-build-l48p479i/spiceypy/setup.py", line 5, in <module>
import getspice
File "/tmp/pip-build-l48p479i/spiceypy/getspice.py", line 13, in <module>
import six.moves.urllib as urllib
ImportError: No module named 'six'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-l48p479i/spiceypy
The command "pip install -r cmd/refframes/reqs.txt" failed and exited with 1 during .
Your build has been stopped.
答案 0 :(得分:1)
解决方案是在其他python要求之前请求安装six
。不知道为什么,但是有效。
这是我更新的.travis.yml
文件:
language: go
go:
- 1.7
addons:
apt:
sources:
- deadsnakes # source required so it finds the package definition below
packages:
- python3.4
- python3.4-dev
before_install:
- go get github.com/axw/gocov/gocov
- go get github.com/mattn/goveralls
- if ! go get code.google.com/p/go.tools/cmd/cover; then go get golang.org/x/tools/cmd/cover; fi
- sudo pip install virtualenv
- virtualenv -p `which python3.4` .venv
- source .venv/bin/activate
- python -V
- pip -V
- pip install six
- pip install -r cmd/refframes/reqs.txt
- wget -O cmd/refframes/spicekernels/de430.bsp https://naif.jpl.nasa.gov/pub/naif/generic_kernels/spk/planets/de430.bsp
script:
- python cmd/refframes/tests.py
- go test -v -timeout=30m -covermode=count -coverprofile=coverage.out
- $HOME/gopath/bin/goveralls -coverprofile=coverage.out -service=travis-ci
env:
- SMD_CONFIG=./