安装 Django-toolbelt 时出现 python_setup.py 和 egg.info 错误

Posted

技术标签:

【中文标题】安装 Django-toolbelt 时出现 python_setup.py 和 egg.info 错误【英文标题】:python_setup.py and egg.info error while installing Django-toolbelt 【发布时间】:2015-07-28 02:08:02 【问题描述】:

我尝试安装 Django-toolbelt,但我不断收到以下内容。我正在使用 Mac。我试过用谷歌搜索解决方案,但没有运气。谢谢。

(venv)Chans-MacBook-Pro:Django_app2 chantrinh$ pip install django-toolbelt
/Users/chantrinh/Django_app2/venv/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:79: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
Collecting django-toolbelt
  Using cached django-toolbelt-0.0.1.tar.gz
Collecting django (from django-toolbelt)
  Using cached Django-1.8.1-py2.py3-none-any.whl
Collecting psycopg2 (from django-toolbelt)
  Using cached psycopg2-2.6.tar.gz
    Complete output from command python setup.py egg_info:
    running egg_info
    creating pip-egg-info/psycopg2.egg-info
    writing pip-egg-info/psycopg2.egg-info/PKG-INFO
    writing top-level names to pip-egg-info/psycopg2.egg-info/top_level.txt
    writing dependency_links to pip-egg-info/psycopg2.egg-info/dependency_links.txt
    writing manifest file 'pip-egg-info/psycopg2.egg-info/SOURCES.txt'
    warning: manifest_maker: standard file '-c' not found

    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'.

    ----------------------------------------
    Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/4r/bh8wxz5d2678zg90jn1715s80000gn/T/pip-build-eUKfh5/psycopg2
(venv)Chans-MacBook-Pro:Django_app2 chantrinh$ pg_config
-bash: pg_config: command not found
(venv)Chans-MacBook-Pro:Django_app2 chantrinh$ sudo find / -name pg_config
find: /dev/fd/3: Not a directory
find: /dev/fd/4: Not a directory

【问题讨论】:

pg_config 是 PostgreSQL 附带的 PostgreSQL 开发库配置脚本。安装 PostgreSQL,例如来自 Homebrew。 Can't install psycopg2 with pip in virtualenv on Mac OS X 10.7 的可能重复项 @MikkoOhtamaa 解决了它!谢谢! 【参考方案1】:

我收到了完全相同的错误消息。但是,就我而言,我已经安装了 psycopg2。发生的事情如下:

我必须先安装 Macports, 然后在python文档中我得到了这一行:

sudo port install py27-psycopg2

但是那一行在

中安装了包
'/opt/local/Library/Frameworks/Python.Framework/....'

而不是

'/Library/Frameworks/Python.Framework/....'

我刚刚创建了一个符号链接来解决问题。

【讨论】:

以上是关于安装 Django-toolbelt 时出现 python_setup.py 和 egg.info 错误的主要内容,如果未能解决你的问题,请参考以下文章

安装带有多个版本py2.7的Google Cloud SDK时出现sqlite3错误

使用 python setup.py install 时出现“错误:‘remap’不是‘cv’的成员”

Python 安装zbar-py时出现 无法打开包括文件: “unistd.h” no such file or directory

Tensorflow 对象检测 API - 当我尝试运行 model_builder_test.py 时出现 ImportError

关于pthon安装一些包时出现的错误解决方法

在 Big Sur 上安装密码学时出现 Pip 错误