Cannot get psycopg2 to work, but installed correctly. Mac OS

后端 未结 1 1615
无人共我
无人共我 2021-01-27 03:51

I\'m trying to work with psycopg2 natively on Mac. It installs fine, with no errors at least, but when i import it get an error message.

I\'ve seen dozens of threads wit

相关标签:
1条回答
  • 2021-01-27 04:25

    Thanks guys.

    @maxymoo I went with your suggestion. I have installed anaconda2. The install updated my path to include /anaconda/bin.

    Then using the navigator I installed pyscopg2. Now I am able to use this in the shebang and my scripts execute fine and i'm able to import this module.

    Gurmokhs-MBP:rest Gurmokh$ python
    Python 2.7.12 |Anaconda 4.2.0 (x86_64)| (default, Jul  2 2016, 17:43:17) 
    [GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)] on darwin
    Type "help", "copyright", "credits" or "license" for more information.
    Anaconda is brought to you by Continuum Analytics.
    Please check out: http://continuum.io/thanks and https://anaconda.org
    >>> import psycopg2
    if psycopg2.connect("dbname='postgres' user='postgres' host='localhost'"):
    ...     print "connection made"
    ... 
    connection made
    >>> 
    
    0 讨论(0)
提交回复
热议问题