【问题标题】:Why Python repo is not installed in WSL?为什么 Python 存储库没有安装在 WSL 中?
【发布时间】:2021-09-10 11:48:48
【问题描述】:

从我的 WSL 终端

pip install schemathesis
Requirement already satisfied: schemathesis in /home/milenko/.local/lib/python3.8/site-packages (3.9.7)
Requirement already satisfied: hypothesis_jsonschema>=0.20.1 in /home/milenko/.local/lib/python3.8/site-packages (from schemathesis) (0.20.1)
Requirement already satisfied: requests<3.0,>=2.22 in /usr/lib/python3/dist-packages (from schemathesis) (2.22.0)
Requirement already satisfied: pytest>4.6.4 in /home/milenko/.local/lib/python3.8/site-packages (from schemathesis) (6.2.5)
Requirement already satisfied: pytest-subtests<1.0,>=0.2.1 in /home/milenko/.local/lib/python3.8/site-packages (from schemathesis) (0.5.0)

当我尝试时

:/mnt/c/Users/v-mimaholmes$ schemathesis

我明白了

schemathesis: command not found

如果我尝试 Tzane 的建议

 python3 -m schemathesis
/usr/bin/python3: No module named schemathesis.__main__; 'schemathesis' is a package and cannot be directly executed

pip freeze 输出

requests-unixsocket==0.2.0
schemathesis==3.9.7
SecretStorage==2.3.1

为什么?

我没有 .local/lib。

【问题讨论】:

  • schemathesis 可执行文件所在的目录是否可能不在您的$PATH 中?
  • @Shinratensei 我不知道模式在哪里。
  • 那我想你应该试着找到它,因为它必须在某个地方

标签: python pip windows-subsystem-for-linux


【解决方案1】:

在 WSL 上,Schemathesis -script 的安装位置不在 $PATH 中,正如 Shinratensei 正确假设的那样。我尝试在 WSL Ubuntu 上自己安装它并得到以下结果:

 The script schemathesis is installed in '/home/taneli/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.

并得到与您相同的错误。将~/.local/bin 添加到$PATH 后,它现在可以按预期工作了:

export PATH=$PATH:~/.local/bin

不是 linux 向导,所以我按照这个关于附加到 $PATH:https://unix.stackexchange.com/a/26059

【讨论】:

    猜你喜欢
    • 2021-09-01
    • 2021-04-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-04-14
    • 1970-01-01
    • 1970-01-01
    • 2023-03-18
    相关资源
    最近更新 更多