0

在安装 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/<package name>

但 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显示正确的路径,以便让我的列表和格式正常工作吗?

4

1 回答 1

2

This fixed it... https://til.hashrocket.com/posts/ques11vrjs-get-pip-installed-executables-into-the-asdf-path

asdf reshim python

I would be curious why I have to do this...if anyone could answer

于 2021-03-03T16:14:53.807 回答