24 lines
1.5 KiB
Markdown
24 lines
1.5 KiB
Markdown
# 20240311135526 pip installでerror externally-managed-environment
|
||
#python #linux
|
||
|
||
(windowsやmacでは関係ないのかもしれない)
|
||
|
||
PEP 668で「OSで使う重要なpythonに、安易にpip install でき、aptなどのOSでのソフト管理の外からいじれるのはよろしくない」ということになった。そのため、従来の `pip install` でライブラリをインストールする記事などは、適宜読みかえが必要。 エラーメッセージに書いてあるように、 python3-[パッケージ名] という名前でOS管理のパッケージがあることが多い。
|
||
```
|
||
To install Python packages system-wide, try apt install
|
||
python3-xyz, where xyz is the package you are trying to
|
||
install.
|
||
|
||
If you wish to install a non-Debian-packaged Python package,
|
||
create a virtual environment using python3 -m venv path/to/venv.
|
||
Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
|
||
sure you have python3-full installed.
|
||
|
||
For more information visit http://rptl.io/venv
|
||
```
|
||
|
||
パッケージが無い場合や、特定のバージョンを使いたい場合などは、 [[memo/public/20240121125457 venv|venv]] でローカル環境を作って対応する。
|
||
|
||
## Ref.
|
||
- [PEP 668 – Marking Python base environments as “externally managed” | peps.python.org](https://peps.python.org/pep-0668/)
|
||
- [俺流!PEP668とうまくやっていく方法 | スクエニ ITエンジニア ブログ](https://blog.jp.square-enix.com/iteng-blog/posts/00043-play-with-the-pep668/)
|