<rp id="wnpn7"><ruby id="wnpn7"></ruby></rp>
<progress id="wnpn7"><track id="wnpn7"><rt id="wnpn7"></rt></track></progress>
<ruby id="wnpn7"></ruby>
<ruby id="wnpn7"><blockquote id="wnpn7"><div id="wnpn7"></div></blockquote></ruby>

    1. <em id="wnpn7"><ruby id="wnpn7"><input id="wnpn7"></input></ruby></em>
      1. <button id="wnpn7"><acronym id="wnpn7"></acronym></button><button id="wnpn7"><acronym id="wnpn7"></acronym></button>

        <rp id="wnpn7"><acronym id="wnpn7"></acronym></rp>

        <li id="wnpn7"><object id="wnpn7"><u id="wnpn7"></u></object></li>
        VB.net 2010 視頻教程 VB.net 2010 視頻教程 python基礎視頻教程
        SQL Server 2008 視頻教程 c#入門經典教程 Visual Basic從門到精通視頻教程
        當前位置:
        首頁 > 編程開發 > Python基礎教程 >
        • python基礎教程之安裝psycopg2出錯問題處理記錄

        本站最新發布   Python從入門到精通|Python基礎教程
        試聽地址  
        http://www.squ68.com/eschool/python.html


        使用postgresql數據庫一直都是在服務器同一臺機子上,所以一向都正常,今天在其他服務器上調用,執行pip3 install psycopg2后直接暴下面錯誤:

        復制代碼
        [root@slave2 ~]# pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple/ 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: /usr/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-v70fvqse/psycopg2/setup.py'"'"'; __file__='"'"'/tmp/pip-install-v70fvqse/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-v70fvqse/psycopg2/pip-egg-info
                 cwd: /tmp/pip-install-v70fvqse/psycopg2/
            Complete output (23 lines):
            running egg_info
            creating /tmp/pip-install-v70fvqse/psycopg2/pip-egg-info/psycopg2.egg-info
            writing /tmp/pip-install-v70fvqse/psycopg2/pip-egg-info/psycopg2.egg-info/PKG-INFO
            writing dependency_links to /tmp/pip-install-v70fvqse/psycopg2/pip-egg-info/psycopg2.egg-info/dependency_links.txt
            writing top-level names to /tmp/pip-install-v70fvqse/psycopg2/pip-egg-info/psycopg2.egg-info/top_level.txt
            writing manifest file '/tmp/pip-install-v70fvqse/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.
        復制代碼

        按錯誤提示,登錄提示地址 http://initd.org/psycopg/docs/install.html 進行查看

        發現原來安裝psycopg2需要先安裝postgresql服務

        復制代碼
        Prerequisites
        The current psycopg2 implementation supports:
        
        Python version 2.7
        Python 3 versions from 3.4 to 3.8
        PostgreSQL server versions from 7.4 to 12
        PostgreSQL client library version from 9.1
        復制代碼

        然后按照要求安裝好了ps數據庫相關服務

        復制代碼
        yum install https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm
        yum install postgresql11
        yum install postgresql11-server
        yum install postgresql11-libs
        yum install postgresql11-contrib
        yum install postgresql11-devel
        復制代碼

        安裝完成后執行pip安裝,還是出錯,重新認真查看官網的安裝要求后,發現還需要配置 pg_config 路徑(這里有點奇怪,我以前在有的服務器上并沒有做這個設置,安裝也是正常)

        按要求在服務器上執行了下面命令:

        export PATH=/usr/pgsql-11/bin/:$PATH

        然后再執行pip安裝psycopg2

        pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple/ psycopg2

        安裝成功

        復制代碼
        [root@slave2 bin]# export PATH=/usr/pgsql-11/bin/:$PATH
        [root@slave2 bin]# pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple/ psycopg2
        Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple/
        Collecting psycopg2
          Downloading https://pypi.tuna.tsinghua.edu.cn/packages/84/d7/6a93c99b5ba4d4d22daa3928b983cec66df4536ca50b22ce5dcac65e4e71/psycopg2-2.8.4.tar.gz (377 kB)
             |████████████████████████████████| 377 kB 4.8 MB/s 
        Building wheels for collected packages: psycopg2
          Building wheel for psycopg2 (setup.py) ... done
          Created wheel for psycopg2: filename=psycopg2-2.8.4-cp37-cp37m-linux_x86_64.whl size=382831 sha256=b2d2c502b6d15be05d06f9fa0864de1e5a46874658939a329e4f08c1f68c925d
          Stored in directory: /root/.cache/pip/wheels/15/11/c5/8f06c23a46a3162b3756d2132a5c5dd4c2edb204049d59ae93
        Successfully built psycopg2
        Installing collected packages: psycopg2
        Successfully installed psycopg2-2.8.4
        復制代碼

         

        只有將自己置空,才能裝進更多的東西!我是陳煥,資深IT碼農,愛分享愛學習,一位奔跑在求知路上的踐行者。

        相關教程
                
        免费看成年人视频大全_免费看成年人视频在线观看