我刚刚安装了全新的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
显示正确的路径,以便我可以得到正确的列表和格式?
asdf reshim
,它也修复了问题。 - cryanbhu