使用pip install时导入错误

时间:2017-09-23 12:51:53

标签: python python-3.x pip

使用pip

成功安装程序
sudo pip install -U rtfd-cli

但在使用时显示错误:

from helpers import formatstr'
'ImportError: No module named 'helpers'

使用

安装时工作正常
sudo python install setup.py

指向计划的链接:https://github.com/MUSoC/rtfd-cli/

2 个答案:

答案 0 :(得分:1)

您安装了 rtfd 而不是帮助。所以python相应地响应,没有名为helpers的模块。

您的问题的答案是:

>>> from rtfd.helpers import formatstr

从未使用过rtfd,我是怎么想出来的?

>>> import rtfd

使用python内置help函数

>>> help(rtfd) # now you see that helpers is an attribute

现在对rtfd.helpers

做同样的事情

>>> help(rtfd.helpers) # now you see formatstr function

答案 1 :(得分:0)

实际的导入是:

svn2git