在VSC中使用asdf无法找到pip包

5

我刚刚安装了全新的BigSur操作系统和Python (使用asdf),但在安装pip包时,它们似乎会被安装在以下路径中:

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

例如,当我键入which flake8时,会出现flake8未找到的提示,但是当我再次尝试安装它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)

我刚刚尝试了使用requests,我像这样安装了它:pip install requests。当我使用which时也找不到它,但我成功在VSC中使用该包。

我正在使用flake8和Black,并且需要提供VSC它们的路径。我已经使用了以下路径:

./.asdf/installs/python/3.9.2/lib/python3.9/site-packages/<package name>

但是,VSC似乎无法pip它。我正在使用最新版本。

> 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 显示正确的路径,以便我可以得到正确的列表和格式?

1个回答

9

我做了asdf reshim,它也修复了问题。 - cryanbhu

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接