卸载位于 /Library/Python/3.9/bin 的软件包

问题描述 投票:0回答:1

我想仅在

conda
环境中安装软件包(streamlit),而不是在系统范围内。但是,当我在环境中转到
pip install
时,它说
/Users/adamg/Library/Python/3.9/bin
中已经满足了要求。如何删除此实例,以便仅在 conda 环境中安装 Streamlit?

这是我在 conda 环境中安装时的输出:

(streamlit0) 22:28:34 ~
○ pip install streamlit
zsh: correct 'streamlit' to '.streamlit' [nyae]? n
Defaulting to user installation because normal site-packages is not writeable
Collecting streamlit
  Using cached streamlit-1.31.0-py2.py3-none-any.whl.metadata (8.1 kB)
Requirement already satisfied: altair<6,>=4.0 in ./Library/Python/3.9/lib/python/site-packages (from streamlit) (5.2.0)
...
Using cached streamlit-1.31.0-py2.py3-none-any.whl (8.4 MB)
Installing collected packages: streamlit
  WARNING: The script streamlit is installed in '/Users/adamg/Library/Python/3.9/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.
Successfully installed streamlit-1.31.0
python pip anaconda streamlit
1个回答
0
投票

就我而言,问题来自于我在

pip
文件中创建了
~/.zshrc
别名(如果您使用的是 bash,它可能是 ~/.bash_profile)。由于我的个人资料有
alias pip=/usr/bin/pip3
,因此无论我是否处于环境中,它都会使用此安装。

您可以在您的

which pip
环境中使用
conda
检查这一点。如果它仍然指向
/usr/bin/pip3
,那么它正在使用您的 User/ 目录。

请注意,在取消别名

pip
,然后使用
pip
安装软件包后,您可能仍然会收到一条消息,表明它正在使用缓存版本。这没关系。您可以在环境中使用
conda list
来确认该软件包确实已安装在环境中。

© www.soinside.com 2019 - 2024. All rights reserved.