解決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 通過(guò)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ò)問題就是小編分享給大家的全部?jī)?nèi)容了,希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。
相關(guān)文章
關(guān)于python多進(jìn)程中的常用方法詳解
這篇文章主要介紹了關(guān)于python多進(jìn)程中的常用方法詳解,python中的多線程其實(shí)并不是真正的多線程,如果想要充分地使用多核CPU資源,在python中大部分情況需要使用多進(jìn)程,需要的朋友可以參考下2023-07-07Python全面分析系統(tǒng)的時(shí)域特性和頻率域特性
今天小編就為大家分享一篇Python全面分析系統(tǒng)的時(shí)域特性和頻率域特性,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧2020-02-02python實(shí)現(xiàn)socket端口重定向示例
這篇文章主要介紹了python實(shí)現(xiàn)的socket端口重定向示例,實(shí)現(xiàn)功能是在端口12345開啟文件共享,此時(shí)我也想通過(guò)8000端口同時(shí)訪問此共享2014-02-02Python 隨機(jī)生成中文驗(yàn)證碼的實(shí)例代碼
Python 隨機(jī)生成中文驗(yàn)證碼的實(shí)例代碼,需要的朋友可以參考一下2013-03-03Python全面解析json數(shù)據(jù)并保存為csv文件
這篇文章主要介紹了Python全面解析json數(shù)據(jù)并保存為csv文件,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2022-07-07利用Python批量識(shí)別電子賬單數(shù)據(jù)的方法
這篇文章主要介紹了利用Python批量識(shí)別電子賬單數(shù)據(jù)的方法,本文給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2021-02-02Python flask框架如何顯示圖像到web頁(yè)面
這篇文章主要介紹了Python flask框架如何顯示圖像到web頁(yè)面,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下2020-06-06超詳細(xì)OpenMV與STM32單片機(jī)通信 附完整源碼
這篇文章主要介紹了OpenMV與STM32單片機(jī)通信的相關(guān)知識(shí),在文章結(jié)尾給大家提供了項(xiàng)目源碼,需要的朋友可以參考下2021-11-11