首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Robotframework -“失败: ImportError:没有模块名为请求”

Robotframework -“失败: ImportError:没有模块名为请求”
EN

Stack Overflow用户
提问于 2017-12-11 09:23:40
回答 1查看 9.4K关注 0票数 2

安装此模块时,我得到了“无模块命名请求”错误(错误后的详细信息):

代码语言:javascript
复制
[ ERROR ] Error in file '/Users/adikeller/Applications/GIT/BeAm/Beacon_4.10/STABILITY/beacon_stability_random_beacon_types.txt': Importing test library 'BeAm.beacon.tests.BeaconTesting' failed: ImportError: No module named requests
Traceback (most recent call last):
  File "/Users/adikeller/Applications/GIT/BeAm/BeAm/beacon/tests.py", line 5, in <module>
    from BeAm.beacon.counters import BeaconCounter
  File "/Users/adikeller/Applications/GIT/BeAm/BeAm/beacon/counters.py", line 1, in <module>
    import requests
PYTHONPATH:
  /Users/adikeller/vevn/bin
  /Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg
  /Users/adikeller/Applications/GIT/BeAm
  /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip
  /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7
  /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin
  /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac
  /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages
  /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk
  /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old
  /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload
  /Library/Python/2.7/site-packages
  /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python
  /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC

我已经做过的事:

  1. 将工作目录添加到PYTHONPATH: export PYTHONPATH=$PYTHONPATH:/Users/adikeller/Applications/GIT/BeAm
  2. 已安装的“请求”模块: sudo pip安装请求
  3. pip冻结:.。request==0.0.22 requests==2.18.3 robot==20071211 robotframework==3.0.2 robotframework-数据库库=0.8.1 robotframework-DiffLibrary2 2=0.0.2.dev0 robotframework-httplibrary=0.4.2 robotframework-pycurllibrary=0.9.5 robotframework-rammbock=0.4.0.1 robotframework-requests=0.4.5.2.1 robotframework-selenium2Library=1.7.4 robotframework-sshlibrary=2.1.2.

更多信息:

  1. 我使用MacBook macOS塞拉利昂(V.10.12.6)
  2. 我在virtualenv中运行,我在其中,所有模块都安装在那里。
  3. 我位于正在运行的文件夹中: /Users/adikeller/Applications/GIT/BeAm
  4. 运行命令行: pybot Beacon_4.10/STABILITY/beacon_stability_random_beacon_types.txt

beacon_stability_random_beacon_types.txt:

代码语言:javascript
复制
*** Settings ***
Force Tags        Critical    template    Conf=3    isTor=0    isSanity=0    headless    rcmd
Library           BeAm.beacon.tests.BeaconTesting    WITH NAME    BeaconTesting
Library           Collections
Library           BeAm.beacon.stability_and_stress_tests
Library           BeAm.beacon.tests
Resource          ../../BeAm/beacon/settings.txt

*** Test Cases ***
Create Test Object
    [Tags]    must
    ${TEST} =    BeaconTesting.Get Beacon Test    3
    Set Suite Variable    ${TEST}    ${TEST}
EN

回答 1

Stack Overflow用户

发布于 2017-12-11 10:15:25

请先安装请求库,然后重试。

代码语言:javascript
复制
$ sudo pip install requests
票数 -1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/47749684

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档