【问题标题】:pip: why doesn't twine command show up sometimespip:为什么有时不显示 twine 命令
【发布时间】:2019-10-15 09:40:21
【问题描述】:

我使用用户标志安装了 twine(用户方案,根据文档):

pip install --user twine

但我不能将它用作命令。例如如果我这样做:

twine --version

它给了我(这很明显):

-bash: twine: command not found

我阅读了this 类似的帖子,但找不到任何满意的答案(答案不被接受)。

我知道我可以使用:

python3 -m twine upload --repository-url https://test.pypi.org/legacy/ dist/*

根据其中一个答案。

但是,我的问题是为什么它没有出现?

我检查了麻线setup.py,发现它使用entry_points(这有助于设置twine command)。在我的假设中,setup.py 被忽略,因为它在安装过程中使用wheel 而不是sdist pip(或下载软件包)。

【问题讨论】:

    标签: python bash pip twine


    【解决方案1】:

    对于命令

    twine --version
    

    shell 尝试在$PATH 中查找twine 二进制文件或脚本。如果找不到脚本,则会发出错误-bash: twine: command not found。这意味着pip 已将twine 安装到不在$PATH 中的目录中。使用命令找出pip 安装它的位置

    pip show --files twine
    

    并将目录添加到$PATH

    对于命令

    python3 -m twine --version
    

    shell 查找 python3python3 -m 查找 模块 twine,而不是脚本。 python3 -msys.path 中查找模块,这是一条完全不同的搜索路径。

    【讨论】:

      猜你喜欢
      • 2017-10-26
      • 1970-01-01
      • 2016-02-28
      • 2017-07-07
      • 2018-10-09
      • 1970-01-01
      • 2023-01-17
      • 2020-07-11
      • 1970-01-01
      相关资源
      最近更新 更多