使用pip ins时的导入错误

2024-05-15 00:25:59 发布

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

程序使用pip成功安装

sudo pip install -U rtfd-cli

但在使用时显示错误:

^{pr2}$

安装时使用

sudo python install setup.py

链接到程序:https://github.com/MUSoC/rtfd-cli/


Tags: installpippyhttps程序githubcomcli
2条回答

实际的导入将是:

from rtfd import helpers
#helpers.formatstr is the function you're looking for

您安装了rtfd而不是helpers。因此python会相应地响应,没有名为helpers的模块。在

你的问题的答案是:

>>> from rtfd.helpers import formatstr

从来没用过rtfd,那我怎么知道的?在

>>> import rtfd

使用python内置的help函数

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

现在也做同样的事rtfd.助手在

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

相关问题 更多 >

    热门问题