m1 的 pgcli 错误,我无法在命令行上运行 pgcli 但出现错误

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

在我收到此错误之前。 我尝试在我的 m1 上安装 pgcli 软件包,并在运行 docker 后按照此命令运行它以运行 pgcli

docker run -it \
  -e POSTGRES_USER="root" \
  -e POSTGRES_PASSWORD="root" \
  -e POSTGRES_DB="ny_taxi" \
  -v $(pwd)/ny_taxi_postgres_data:/var/lib/postgresql/pg_data \
  -p 5001:5002 \
  postgres:13
pip3 install pgcli 

然后跑

pgcli

在命令行上请帮忙。

Traceback (most recent call last):
  File "/opt/homebrew/bin/pgcli", line 5, in <module>
    from pgcli.main import cli
  File "/opt/homebrew/lib/python3.10/site-packages/pgcli/main.py", line 2, in <module>
    from pgspecial.namedqueries import NamedQueries
  File "/opt/homebrew/lib/python3.10/site-packages/pgspecial/__init__.py", line 13, in <module>
    from . import iocommands
  File "/opt/homebrew/lib/python3.10/site-packages/pgspecial/iocommands.py", line 9, in <module>
    import psycopg
  File "/opt/homebrew/lib/python3.10/site-packages/psycopg/__init__.py", line 9, in <module>
    from . import pq  # noqa: F401 import early to stabilize side effects
  File "/opt/homebrew/lib/python3.10/site-packages/psycopg/pq/__init__.py", line 114, in <module>
    import_from_libpq()
  File "/opt/homebrew/lib/python3.10/site-packages/psycopg/pq/__init__.py", line 106, in import_from_libpq
    raise ImportError(
ImportError: no pq wrapper available.
Attempts made:
- couldn't import psycopg 'c' implementation: No module named 'psycopg_c'
- couldn't import psycopg 'binary' implementation: No module named 'psycopg_binary'
- couldn't import psycopg 'python' implementation: libpq library not found```

I try to run pgcli on mac m1 , after i run pgcli i should got this comment

alexay 的密码

follow this tutorial 
[data-engineer-zoomcamp](https://youtu.be/2JM-ziJt0WI?list=PL3MmuxUbc_hJed7dXYoJw8DoCuVHhGEQb&t=457)
python postgresql psycopg2 apple-m1
1个回答
0
投票

这对我有用(Apple M1 Pro、macOD Venturs 13.6.3)

pip install "psycopg[binary,pool]"
© www.soinside.com 2019 - 2024. All rights reserved.