Python Anaconda阻塞psql连接

2024-10-04 11:26:11 发布

您现在位置:Python中文网/ 问答频道 /正文

我在Ubuntu20.04LTS和Python3.8.2上有一个PythonAnaconda环境,当激活该环境时,它会阻止psql连接到本地PostgreSQL数据库。这是一个完全可重复的条件:activate它不起作用,deactivate它起作用。所以我可以通过激活和取消激活来解决这个问题,但这是一种痛苦。我可以改变什么或如何开始诊断

错误:

psql: could not connect to server: No such file or directory
        Is the server running locally and accepting
        connections on Unix domain socket "/tmp/.s.PGSQL.5432"?

conda env export结果:

channels:
  - anaconda
  - defaults
dependencies:
  - _libgcc_mutex=0.1=main
  - attrs=21.2.0=pyhd3eb1b0_0
  - beautifulsoup4=4.9.3=pyha847dfd_0
  - blas=1.0=mkl
  - brotlipy=0.7.0=py38h27cfd23_1003
  - bs4=4.9.3=hd3eb1b0_0
  - bzip2=1.0.8=h7b6447c_0
  - ca-certificates=2021.4.13=h06a4308_1
  - cairo=1.14.12=h8948797_3
  - certifi=2020.12.5=py38h06a4308_0
  - cfitsio=3.470=hb7c8383_2
  - click=7.1.2=pyhd3eb1b0_0
  - click-plugins=1.1.1=py_0
  - cligj=0.7.1=py38h06a4308_0
  - cryptography=3.4.7=py38hd23ed53_0
  - curl=7.67.0=hbc83047_0
  - expat=2.4.1=h2531618_2
  - fiona=1.8.13.post1=py38hc820daa_0
  - fontconfig=2.13.1=h6c09931_0
  - freetype=2.10.4=h5ab3b9f_0
  - freexl=1.0.6=h27cfd23_0
  - gdal=3.0.2=py38hbb2a789_0
  - geopandas=0.8.1=py_0
  - geos=3.8.0=he6710b0_0
  - geotiff=1.5.1=h21e8280_1
  - giflib=5.1.4=h14c3975_1
  - glib=2.63.1=h5a9c865_0
  - hdf4=4.2.13=h3ca952b_2
  - hdf5=1.10.4=hb1b8bf9_0
  - icu=58.2=he6710b0_3
  - idna=3.1=pyhd3eb1b0_0
  - intel-openmp=2021.2.0=h06a4308_610
  - jpeg=9b=h024ee3a_2
  - json-c=0.13.1=h1bed415_0
  - kealib=1.4.7=hd0c454d_6
  - krb5=1.16.4=h173b8e3_0
  - ld_impl_linux-64=2.33.1=h53a641e_7
  - libboost=1.67.0=h46d08c1_4
  - libcurl=7.67.0=h20c2e04_0
  - libdap4=3.19.1=h6ec2957_0
  - libedit=3.1.20210216=h27cfd23_1
  - libffi=3.2.1=hf484d3e_1007
  - libgcc-ng=9.1.0=hdf63c60_0
  - libgdal=3.0.2=h27ab9cc_0
  - libgfortran-ng=7.3.0=hdf63c60_0
  - libkml=1.3.0=h590aaf7_4
  - libnetcdf=4.6.1=h11d0813_2
  - libpng=1.6.37=hbc83047_0
  - libpq=11.2=h20c2e04_0
  - libspatialindex=1.9.3=h2531618_0
  - libspatialite=4.3.0a=h793db0d_0
  - libssh2=1.9.0=h1ba5d50_1
  - libstdcxx-ng=9.1.0=hdf63c60_0
  - libtiff=4.1.0=h2733197_0
  - libuuid=1.0.3=h1bed415_2
  - libxcb=1.14=h7b6447c_0
  - libxml2=2.9.10=hb55368b_3
  - lz4-c=1.8.1.2=h14c3975_0
  - mkl=2021.2.0=h06a4308_296
  - mkl-service=2.3.0=py38h27cfd23_1
  - mkl_fft=1.3.0=py38h42c9631_2
  - mkl_random=1.2.1=py38ha9443f7_2
  - munch=2.5.0=py_0
  - ncurses=6.2=he6710b0_1
  - numpy=1.20.2=py38h2d18471_0
  - numpy-base=1.20.2=py38hfae3a4d_0
  - openjpeg=2.3.0=h05c96fa_1
  - openssl=1.1.1k=h27cfd23_0
  - pandas=1.1.3=py38he6710b0_0
  - pcre=8.44=he6710b0_0
  - pip=21.1.1=py38h06a4308_0
  - pixman=0.40.0=h7b6447c_0
  - poppler=0.65.0=h581218d_1
  - poppler-data=0.4.10=h06a4308_0
  - postgresql=11.2=h20c2e04_0
  - proj=6.2.1=haa6030c_0
  - psycopg2=2.8.4=py38h1ba5d50_0
  - pycparser=2.20=py_2
  - pyopenssl=20.0.1=pyhd3eb1b0_1
  - pyproj=2.6.1.post1=py38hb3025e9_1
  - pysocks=1.7.1=py38h06a4308_0
  - python=3.8.2=h191fe78_0
  - python-dateutil=2.8.1=pyhd3eb1b0_0
  - pytz=2021.1=pyhd3eb1b0_0
  - readline=7.0=h7b6447c_5
  - rtree=0.9.7=py38h06a4308_1
  - selenium=3.141.0=py38h27cfd23_1000
  - setuptools=52.0.0=py38h06a4308_0
  - shapely=1.7.1=py38h98ec03d_0
  - six=1.15.0=py38h06a4308_0
  - soupsieve=2.2.1=pyhd3eb1b0_0
  - sqlalchemy=1.3.19=py38h7b6447c_0
  - sqlite=3.33.0=h62c20be_0
  - tbb=2018.0.5=h6bb024c_0
  - tiledb=1.6.3=h1fb8f14_0
  - tk=8.6.10=hbc83047_0
  - urllib3=1.26.4=pyhd3eb1b0_0
  - wheel=0.36.2=pyhd3eb1b0_0
  - xerces-c=3.2.3=h780794e_0
  - xlrd=2.0.1=pyhd3eb1b0_0
  - xz=5.2.5=h7b6447c_0
  - zlib=1.2.11=h7b6447c_3
  - zstd=1.3.7=h0b5b093_0
  - pip:
    - cffi==1.14.5
    - chardet==4.0.0
    - pdfminer-six==20201018
    - sortedcontainers==2.4.0

Tags: py环境ngpsqlmklpyhd3eb1b0hdf63c60h7b6447c