python pip3 安装psycopg2报错
pip3安装psycopg2报错
[root@edb ~]$ pip3 install psycopg2
Defaulting to user installation because normal site-packages is not writeable
Collecting psycopg2
Using cached psycopg2-2.9.3.tar.gz (380 kB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [1 lines of output]
ERROR: Can not execute `setup.py` since setuptools is not available in the build environment.
[end of output]note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed× Encountered error while generating package metadata.
╰─> See above for output.note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
最后倒数第二句说的是包的问题,不是pip命令的问题,说明python安装的是没问题的,解决方案:
[root@edb ~]$ pip3 install --upgrade setuptools
[root@edb ~]$ pip3 install psycopg2
或者如下,多一步:
[root@edb ~]$ pip3 install --upgrade setuptools
Requirement already satisfied: setuptools in /usr/local/Python3.10/lib/python3.10/site-packages (58.1.0)
Collecting setuptools
Downloading setuptools-68.2.2-py3-none-any.whl (807 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 807.9/807.9 KB 991.8 kB/s eta 0:00:00
Installing collected packages: setuptools
Attempting uninstall: setuptools
Found existing installation: setuptools 58.1.0
Uninstalling setuptools-58.1.0:
Successfully uninstalled setuptools-58.1.0
Successfully installed setuptools-68.2.2
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
WARNING: You are using pip version 22.0.4; however, version 23.2.1 is available.
You should consider upgrading via the '/usr/local/Python3.10/bin/python3.10 -m pip install --upgrade pip' command.
[root@edb ~]$ python3 -m pip install --upgrade pip
[root@edb ~]$ pip3 install psycopg2
更多推荐
所有评论(0)