关于启动报错ModuleNotFoundError:No module named ‘psycopg2‘(安装psycopg2失败)

deepin系统,安装psycopg2失败,解决方案

(even) :~/app$ pip install psycopg2==2.8.6
Collecting psycopg2==2.8.6
  Using cached psycopg2-2.8.6.tar.gz (383 kB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [9 lines of output]
      running egg_info
      creating /tmp/pip-pip-egg-info-udhmvwqf/psycopg2.egg-info
      writing /tmp/pip-pip-egg-info-udhmvwqf/psycopg2.egg-info/PKG-INFO
      writing dependency_links to /tmp/pip-pip-egg-info-udhmvwqf/psycopg2.egg-info/dependency_links.txt
      writing top-level names to /tmp/pip-pip-egg-info-udhmvwqf/psycopg2.egg-info/top_level.txt
      writing manifest file '/tmp/pip-pip-egg-info-udhmvwqf/psycopg2.egg-info/SOURCES.txt'
      /home/jason/app/even/lib/python3.8/site-packages/setuptools/config/setupcfg.py:508: SetuptoolsDeprecationWarning: The license_file parameter is deprecated, use license_files instead.
        warnings.warn(msg, warning_class)
      Error: b'You need to install postgresql-server-dev-NN for building a server-side extension or libpq-dev for building a client-side application.\n'
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
 


解决方案:

sudo apt-get install libpq-dev python-dev
sudo apt-get install python-psycopg2
 pip install psycopg2==2.8.6

之后再次安装即可


————————————————
版权声明:本文为CSDN博主「Chaos Rings」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/qq_44132542/article/details/103182244

你可能感兴趣的:(postgresql,数据库)