无法在Travis CI上生成python项目

2024-09-26 17:46:04 发布

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

我已经安装了pyhash,为什么它总是说找不到模块?有人能帮我吗?在

这是我的。特拉维斯·伊梅尔公司名称:

language: python
before_install:
    - sudo apt-get -qq update
    - sudo apt-get install libboost-all-dev
python:
    - "2.7"
install:
    - sudo pip install pyhash
script: py.test

这是我的项目目录:

^{pr2}$

错误消息是:

ImportError: No module named pyhash

但我看到它安装在命令窗口。在


Tags: 模块installdev名称getsudo公司apt
1条回答
网友
1楼 · 发布于 2024-09-26 17:46:04

TL;DR:尝试删除所有sudo调用,使用附加组件:易于安装boost requirements和pip install user pyhash(但是这对python3.5没有帮助)。在

我做了几个测试,看起来如果您使用sudo pip install来安装包,那么安装脚本用户就看不到它了。例如,请参见this travis build。 在我的测试中,sudo: required是否被添加到.travis.yml中并不重要。在

不幸的是without sudo由于PermissionError: [Errno 13] Permission denied: '/usr/lib/libboost_python.so'错误,pip install pyhash是不可能的。在

不过,我在stackoverflow上也发现了this问题,看起来你可以用pip install user代替{}。在

我也tested这种方法,不幸的是你不能在我的配置中使用 user。错误是:Can not perform a ' user' install. User site-packages are not visible in this virtualenv.

所以最后我试着用apt addon代替sudo apt-get install来确保sudo:required没有被使用,但它也是did not help。在

如果不尝试为travis-ci创建问题,也许您在python2.7上会更幸运

相关问题 更多 >

    热门问题