【问题标题】:unable to locate pip packages using asdf in VSC无法在 VSC 中使用 asdf 定位 pip 包
【发布时间】:2021-06-02 05:51:10
【问题描述】:

在安装 pip 包时,我刚刚安装了全新的 BigSur 和 Python(使用 asdf),它们似乎最终会出现在:

./.asdf/installs/python/3.9.2/lib/python3.9/site-packages

例如,当我输入which flake8 时,我得到flake8 not found,但是当我再次安装它时pip install flake8,我得到以下信息:

> which flake8
flake8 not found

~
> pip install flake8
Requirement already satisfied: flake8 in ./.asdf/installs/python/3.9.2/lib/python3.9/site-packages (3.8.4)
Requirement already satisfied: pycodestyle<2.7.0,>=2.6.0a1 in ./.asdf/installs/python/3.9.2/lib/python3.9/site-packages (from flake8) (2.6.0)
Requirement already satisfied: mccabe<0.7.0,>=0.6.0 in ./.asdf/installs/python/3.9.2/lib/python3.9/site-packages (from flake8) (0.6.1)
Requirement already satisfied: pyflakes<2.3.0,>=2.2.0 in ./.asdf/installs/python/3.9.2/lib/python3.9/site-packages (from flake8) (2.2.0)

我刚刚尝试使用像pip install requests 这样安装的请求,使用which 时也没有找到,但我设法在VSC 中使用该包。

我正在使用 flake8 和 Black,我需要为 VSC 提供它们的路径。我用过

./.asdf/installs/python/3.9.2/lib/python3.9/site-packages/&lt;package name&gt;

但 VSC 似乎并没有解决这个问题。我使用的是最新版本。

> python -V
Python 3.9.2

~
> pip -V
pip 21.0.1 from /Users/paul/.asdf/installs/python/3.9.2/lib/python3.9/site-packages/pip (python 3.9)

这也可能有帮助:

~
> which python
/Users/paul/.asdf/shims/python

~
> which pip
/Users/paul/.asdf/shims/pip

知道如何让which 显示正确的路径,以便让我的列表和格式正常工作吗?

【问题讨论】:

    标签: python-3.x visual-studio-code pip asdf-vm


    【解决方案1】:

    这解决了它...https://til.hashrocket.com/posts/ques11vrjs-get-pip-installed-executables-into-the-asdf-path

    asdf reshim python

    我会很好奇为什么我必须这样做......如果有人可以回答

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-07-25
      • 1970-01-01
      • 2020-07-28
      • 2020-11-20
      • 2021-01-29
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多