解決pip install psycopg2出錯(cuò)問題
pip install psycopg2出現(xiàn)錯(cuò)誤:
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
補(bǔ)充知識(shí):anaconda 通過pip 安裝python psycopg2
1. 【不能在cmd里install】之前一直在 cmd 里conda install psycopg2 ,pip install psycopg2,雖然提示安裝成功,但是import時(shí)還是會(huì)報(bào)錯(cuò)提示包不存在。
2. 【在prompt里pip】正確的安裝方法是,安裝完成 anaconda,進(jìn)入anaconda prompt,輸入命令即可
pip install psycopg2

3. import psycopg2 未報(bào)錯(cuò),安裝成功。
以上這篇解決pip install psycopg2出錯(cuò)問題就是小編分享給大家的全部內(nèi)容了,希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。
相關(guān)文章
解決redis與Python交互取出來的是bytes類型的問題
這篇文章主要介紹了解決redis與Python交互取出來的是bytes類型的問題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過來看看吧2020-07-07
如何在Python里使用ChatGPT及ChatGPT簡(jiǎn)介
今年最火的應(yīng)該就是ChatGPT了,現(xiàn)在短短2個(gè)月已經(jīng)突破了1億注冊(cè)用戶,馬斯克可高興壞了,這篇文章主要介紹了如何在Python里使用ChatGPT及ChatGPT是什么?注冊(cè)方式?需要的朋友可以參考下2023-02-02
Python實(shí)現(xiàn)簡(jiǎn)單的HttpServer服務(wù)器示例
本篇文章主要介紹了Python實(shí)現(xiàn)簡(jiǎn)單的HttpServer服務(wù)器示例,小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧2017-09-09
Pytorch?nn.Unfold()?與?nn.Fold()圖碼詳解(最新推薦)
這篇文章主要介紹了Pytorch?nn.Unfold()?與?nn.Fold()圖碼詳解,本文給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2023-05-05

