Closed5
brew install で勝手にpythonついてくる
発端
poetryでpoetry installとかして仮想環境作るとpyenvでglobal/localに設定しているPythonバージョンじゃなくてbrewでインストールされてるpython@3.11を見に行ってた
$ poetry env info
Virtualenv
Python: 3.11.1
Implementation: CPython
Path: /home/enven/workspace/any_project/.venv
Executable: /home/enven/workspace/any_project/.venv/bin/python
Valid: True
System
Platform: linux
OS: posix
Python: 3.11.1
Path: /home/linuxbrew/.linuxbrew/opt/python@3.11
Executable: /home/linuxbrew/.linuxbrew/opt/python@3.11/bin/python3.11
$ pyenv version
3.9.16 (set by /home/enven/workspace/any_project/.python-version)
そもそもbrewでpythonインストールした記憶がないが、awscliとかPoetryとかPython3に依存するパッケージをインストールする際にpyenvをインストールしてなかったからpython3も一緒にインストールされたっぽい?
uninstallしようとすると警告が出る
$ brew uninstall python@3.11
Error: Refusing to uninstall /home/linuxbrew/.linuxbrew/Cellar/python@3.11/3.11.1
because it is required by awscli, docutils, pipenv, poetry and virtualenv, which are currently installed.
You can override this and force removal with:
brew uninstall --ignore-dependencies python@3.11
むりやりbrewのpython消すと依存パッケージが動かなくなる
$ brew uninstall --ignore-dependencies python@3.11
Uninstalling /home/linuxbrew/.linuxbrew/Cellar/python@3.11/3.11.1... (2,743 files, 66.9MB)
$ pipenv
/home/linuxbrew/.linuxbrew/bin/pipenv: /home/linuxbrew/.linuxbrew/Cellar/pipenv/2022.12.19/libexec/bin/pipenv: /home/linuxbrew/.linuxbrew/Cellar/pipenv/2022.12.19/libexec/bin/python3.11: bad interpreter: No such file or directory
/home/linuxbrew/.linuxbrew/bin/pipenv: line 2: /home/linuxbrew/.linuxbrew/Cellar/pipenv/2022.12.19/libexec/bin/pipenv: Success
brew pythonを消してpipenvも消して依存関係なしでインストールしてもダメっぽい
$ brew install pipenv --ignore-dependencies
$ pipenv
/home/linuxbrew/.linuxbrew/bin/pipenv: /home/linuxbrew/.linuxbrew/Cellar/pipenv/2022.12.19/libexec/bin/pipenv: /home/linuxbrew/.linuxbrew/Cellar/pipenv/2022.12.19/libexec/bin/python3.11: bad interpreter: No such file or directory
/home/linuxbrew/.linuxbrew/bin/pipenv: line 2: /home/linuxbrew/.linuxbrew/Cellar/pipenv/2022.12.19/libexec/bin/pipenv: Success
- 対策
- poetry, pipenvなどpyenv依存のものはbrew使わない
- pipx使うか
- poetry, pipenvなどpyenv依存のものはbrew使わない
このスクラップは2023/04/04にクローズされました