https://github.com/gh640/python-psycopg2-installation-arm-mac
(Japanese) ARM (M1) Mac に Python `psycopg2` をインストールする手順まとめ
https://github.com/gh640/python-psycopg2-installation-arm-mac
postgresql psycopg2 python3
Last synced: 3 months ago
JSON representation
(Japanese) ARM (M1) Mac に Python `psycopg2` をインストールする手順まとめ
- Host: GitHub
- URL: https://github.com/gh640/python-psycopg2-installation-arm-mac
- Owner: gh640
- Created: 2022-08-08T03:56:58.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2022-08-08T04:00:19.000Z (almost 4 years ago)
- Last Synced: 2025-03-04T10:25:27.267Z (over 1 year ago)
- Topics: postgresql, psycopg2, python3
- Language: Dockerfile
- Homepage:
- Size: 2.93 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# (Japanese) ARM (M1) Mac に Python `psycopg2` をインストールする手順まとめ
ARM (M1) Mac 上の Docker (Docker for Mac) で Python パッケージ `psycopg2` をインストールするための手順のまとめです。
| ベースイメージ | サンプルディレクトリ |
| --- | --- |
| `debian:bookworm` | [`debian-bookworm/`](./debian-bookworm/) |
| `debian:bullseye` | [`debian-bullseye/`](./debian-bullseye/) |
| `python:3.10` | [`python-3.10/`](./python-3.10/) |
| `python:3.10-alpine` | [`python-3.10-alpine/`](./python-3.10-alpine/) |
| `ubuntu:20.04` | [`ubuntu-20.04/`](./ubuntu-20.04/) |
| `ubuntu:22.04` | [`ubuntu-22.04/`](./ubuntu-22.04/) |
`python:3.10` の場合はそのまま `psycopg2` をインストールするだけで OK です:
```zsh
python3 -m pip install psycopg2
```
`python:3.10-alpine` の場合は `apk` で `gcc` `musl-dev` `postgresql-dev` などを入れる必要があります:
```zsh
apk add gcc musl-dev postgresql-dev
```
`debian` や `ubuntu` の場合はもう少し多くのパッケージを入れる必要があります:
```zsh
apt-get install -y --no-install-recommends \
build-essential \
libpq-dev \
python3 \
python3-dev \
python3-pip
```
詳細はサブディレクトリの各 `Dockerfile` を参照してください。