Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/variables/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 如何在linux中解决psycopg2的这个路径错误?_Python_Django_Conda_Postgis - Fatal编程技术网

Python 如何在linux中解决psycopg2的这个路径错误?

Python 如何在linux中解决psycopg2的这个路径错误?,python,django,conda,postgis,Python,Django,Conda,Postgis,我使用的是conda软件包,在尝试安装psycopg2时出现了此错误。 我想把这个用于postgis,我正在ubuntu上运行 ERROR: Command errored out with exit status 1: command: /home/srijan/anaconda3/envs/django/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip

我使用的是conda软件包,在尝试安装psycopg2时出现了此错误。 我想把这个用于postgis,我正在ubuntu上运行

    ERROR: Command errored out with exit status 1:
     command: /home/srijan/anaconda3/envs/django/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-s5yimrpg/psycopg2/setup.py'"'"'; __file__='"'"'/tmp/pip-install-s5yimrpg/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-pip-egg-info-cop18avg
         cwd: /tmp/pip-install-s5yimrpg/psycopg2/
    Complete output (14 lines):
    running egg_info
    creating /tmp/pip-pip-egg-info-cop18avg/psycopg2.egg-info
    writing /tmp/pip-pip-egg-info-cop18avg/psycopg2.egg-info/PKG-INFO
    writing dependency_links to /tmp/pip-pip-egg-info-cop18avg/psycopg2.egg-info/dependency_links.txt
    writing top-level names to /tmp/pip-pip-egg-info-cop18avg/psycopg2.egg-info/top_level.txt
    writing manifest file '/tmp/pip-pip-egg-info-cop18avg/psycopg2.egg-info/SOURCES.txt'
    Error: pg_config executable not found.
    
    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'.
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.


安装
python-dev
(可能是
python3-dev
,根据当前的python版本安装)和
libpq-dev
应该可以解决您的问题


也可以看看这个问题。它谈到了同样的问题。

请在问题中包括您运行的实际命令。您是否尝试过
conda安装-n django psycopg2
?我使用
pip安装psycopg2
并使用python3.6和conda来管理@mervWhile包,这可能与系统级Python安装相关,如果使用
Conda安装
,Conda环境安装将自动管理此类依赖关系-这是一种Conda的观点。此外,即使这是解决方案,这也应该是一个建议的重复评论,而不是一个答案。@merv当然,谢谢你指出。我不知道conda是否像python应用程序的PaaS一样工作。但对于原始安装,需要安装dev软件包。