解决pip install psycopg2出错问题
作者:喝粥也会胖的唐僧 时间:2023-01-22 01:41:09
pip install psycopg2出现错误:
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting psycopg2
Using cached https://pypi.tuna.tsinghua.edu.cn/packages/84/d7/6a93c99b5ba4d4d22daa3928b983cec66df4536ca50b22ce5dcac65e4e71/psycopg2-2.8.4.tar.gz (377 kB)
ERROR: Command errored out with exit status 1:
command: /opt/AN/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-lkf6b0y5/psycopg2/setup.py'"'"'; __file__='"'"'/tmp/pip-install-lkf6b0y5/psycopg2/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-install-lkf6b0y5/psycopg2/pip-egg-info
cwd: /tmp/pip-install-lkf6b0y5/psycopg2/
Complete output (23 lines):
running egg_info
creating /tmp/pip-install-lkf6b0y5/psycopg2/pip-egg-info/psycopg2.egg-info
writing /tmp/pip-install-lkf6b0y5/psycopg2/pip-egg-info/psycopg2.egg-info/PKG-INFO
writing dependency_links to /tmp/pip-install-lkf6b0y5/psycopg2/pip-egg-info/psycopg2.egg-info/dependency_links.txt
writing top-level names to /tmp/pip-install-lkf6b0y5/psycopg2/pip-egg-info/psycopg2.egg-info/top_level.txt
writing manifest file '/tmp/pip-install-lkf6b0y5/psycopg2/pip-egg-info/psycopg2.egg-info/SOURCES.txt'
Error: pg_config executable not found.
pg_config is required to build psycopg2 from source. Please add the directory
containing pg_config to the $PATH or specify the full executable path with the
option:
python setup.py build_ext --pg-config /path/to/pg_config build ...
or with the pg_config option in 'setup.cfg'.
If you prefer to avoid building psycopg2 from source, please install the PyPI
'psycopg2-binary' package instead.
For further information please check the 'doc/src/install.rst' file (also at
<http://initd.org/psycopg/docs/install.html>).
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
解决方法:
yum install postgresql postgresql-devel python-devel python3-devel
补充知识:anaconda 通过pip 安装python psycopg2
1. 【不能在cmd里install】之前一直在 cmd 里conda install psycopg2 ,pip install psycopg2,虽然提示安装成功,但是import时还是会报错提示包不存在。
2. 【在prompt里pip】正确的安装方法是,安装完成 anaconda,进入anaconda prompt,输入命令即可
pip install psycopg2
3. import psycopg2 未报错,安装成功。
来源:https://blog.csdn.net/zhou_438/article/details/104944275
标签:pip,install,psycopg2
0
投稿
猜你喜欢
div、section、article 的区别
2011-02-26 15:39:00
利用ASP.NET MVC和Bootstrap快速搭建响应式个人博客站(一)
2023-07-06 23:47:39
比较不错的函数式JavaScript编程指南教程
2023-08-25 08:24:41
Python定时任务APScheduler的实例实例详解
2023-03-18 01:33:05
如何用Python绘制棒棒糖图表
2021-05-02 06:26:33
python3利用ctypes传入一个字符串类型的列表方法
2021-06-10 20:33:36
非原型 不设计
2010-01-21 12:51:00
浅谈opencv自动光学检测、目标分割和检测(连通区域和findContours)
2023-04-15 09:25:18
python 发送邮件的四种方法汇总
2022-04-09 05:44:18
python输出国际象棋棋盘的实例分享
2023-10-31 08:49:49
pytorch中Tensor.to(device)和model.to(device)的区别及说明
2021-10-20 05:26:06
python人工智能tensorflow优化器Optimizer算法汇总
2023-12-06 14:44:51
Django如何开发简单的查询接口详解
2022-07-06 11:27:57
浅谈Python数学建模之整数规划
2021-12-01 18:26:07
Go语言通过WaitGroup实现控制并发的示例详解
2023-06-29 01:04:27
“你帮我把这个做成这个样子!”—当我听到这句话
2009-04-16 12:57:00
浅析Python数字类型和字符串类型的内置方法
2022-06-16 12:57:24
sqlserver服务器验证改为混合验证模式步骤
2024-01-20 18:02:28
python利用高阶函数实现剪枝函数
2022-04-17 11:21:44
pandas 时间格式转换的实现
2021-03-23 13:09:01