相关疑难解决方法(0)

Mac + virtualenv + pip + postgresql =错误:找不到pg_config可执行文件

我试图为教程安装postgres,但是pip给了我错误:

pip install psycopg
Run Code Online (Sandbox Code Playgroud)

我得到一个错误:

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'.
Run Code Online (Sandbox Code Playgroud)

pg_config我的virtualenv 在哪里?如何配置?我正在使用virtualenv,因为我不想在系统范围内安装postgres.

python postgresql macos psycopg2

74
推荐指数
9
解决办法
6万
查看次数

如何查找pg_config路径

在这里完成新手,试图设置Django与ProstgreSQL一起工作.

我正在使用mac osx 10.6.8.我还安装了PostgreSQL 9.3

当我pip install psycopg2在终端运行时,我收到以下错误

Downloading/unpacking psycopg2
  Downloading psycopg2-2.5.2.tar.gz (685kB): 685kB downloaded
  Running setup.py (path:/private/var/folders/A9/A99cs6x0FNusPejCVkYNTE+++TI/-Tmp-/pip_build_bengorman/psycopg2/setup.py) egg_info for package psycopg2

    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'.
    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 …
Run Code Online (Sandbox Code Playgroud)

python django postgresql macos

62
推荐指数
9
解决办法
9万
查看次数

pyproject.toml 文件有什么用?

背景

我正要尝试从 GitHub 下载的 Python 包,发现它没有 . setup.py,所以我无法安装它

pip install -e <folder>
Run Code Online (Sandbox Code Playgroud)

相反,该包有一个pyproject.toml文件,该文件似乎与setup.py通常的条目非常相似。

我发现了什么

谷歌搜索引导我进入PEP-518,它setup.py在基本原理部分给出了一些批评。但是,它没有明确说明setup.py应该避免使用 ,或者pyproject.toml完全取代setup.py.

问题

pyproject.toml用来代替的东西setup.py吗?或者一个包应该同时带有 apyproject.toml和 a setup.py
如何安装pyproject.toml处于可编辑状态的项目?

python packaging pip pyproject.toml

55
推荐指数
4
解决办法
2万
查看次数

无法通过pip install安装psycopg2包...这是因为Sierra?

我正在为我的一个讲座工作项目,我需要下载包psycopg2才能使用正在使用的postgresql数据库.不幸的是,当我尝试pip安装psycopg2时会弹出以下错误:

ld: library not found for -lssl
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command '/usr/bin/clang' failed with exit status 1
ld: library not found for -lssl
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command '/usr/bin/clang' failed with exit status 1
Run Code Online (Sandbox Code Playgroud)

有谁知道为什么会这样?是因为Sierra没有支持某些套餐吗?提前致谢!

python pip psycopg2

50
推荐指数
7
解决办法
2万
查看次数

错误:在Docker中的Alpine上安装psycopg2时找不到pg_config可执行文件

我正在尝试使用Postgres和Docker构建Flask应用程序.我想连接到Postgres的AWS RDS实例,但是使用Docker作为我的Flask应用程序.但是,当尝试设置psycopg2它时会遇到错误,因为它无法找到pg_config.这是错误:

Building api
Step 1/5 : FROM python:3.6.3-alpine3.6
 ---> 84c98ca3b5c5
Step 2/5 : WORKDIR /usr/src/app
 ---> Using cache
 ---> 407c158f5ee4
Step 3/5 : COPY . .
 ---> 966df18d329e
Step 4/5 : RUN pip install -r requirements.txt
 ---> Running in 284cc97aeb63
Collecting aniso8601==1.3.0 (from -r requirements.txt (line 1))
  Downloading aniso8601-1.3.0.tar.gz (57kB)
Collecting click==6.7 (from -r requirements.txt (line 2))
  Downloading click-6.7-py2.py3-none-any.whl (71kB)
Collecting Flask==0.12.2 (from -r requirements.txt (line 3))
  Downloading Flask-0.12.2-py2.py3-none-any.whl (83kB)
Collecting Flask-RESTful==0.3.6 (from -r requirements.txt …
Run Code Online (Sandbox Code Playgroud)

python postgresql psycopg2 docker

39
推荐指数
4
解决办法
3万
查看次数

Django/Python初学者:执行python manage.py syncdb时出错 - 找不到psycopg2

我使用Macports安装了Pythong2.6,psycopg2和pgAdmin3.我的settings.py是:

DATABASE_ENGINE = 'postgresql_psycopg2'           # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
DATABASE_NAME = 'mysite'             # Or path to database file if using sqlite3.
DATABASE_USER = 'postgres'             # Not used with sqlite3.
DATABASE_PASSWORD = ''         # Not used with sqlite3.
DATABASE_HOST = ''             # Set to empty string for localhost. Not used with sqlite3.
DATABASE_PORT = ''             # Set to empty string for default. Not used with sqlite3.
Run Code Online (Sandbox Code Playgroud)

我运行python manage.py syncdb时得到的错误是:

Traceback (most recent call last):
  File "manage.py", line 11, in …
Run Code Online (Sandbox Code Playgroud)

python django django-syncdb

36
推荐指数
4
解决办法
7万
查看次数

在mac osx 10.9.5上安装Psycopg2

我正在尝试在我的Mac书上安装Psycopg2.我仍然得到同样的错误.我在Stack Overflow上发现了很多相同的问题,但似乎没有答案可行.我认为它已经过时了.我正在使用:

Mac osx 10.9.5
Python 3.4.3
Run Code Online (Sandbox Code Playgroud)

我的错误代码是:

运行setup.py egg_info for package psycopg2错误:找不到pg_config可执行文件.

请将包含pg_config的目录添加到PATH,或使用以下选项指定完整的可执行文件路径:

python setup.py build_ext --pg-config/path/to/pg_config build ...

或者使用'setup.cfg'中的pg_config选项.从命令python setup.py egg_info完成输出:运行egg_info

写pip-egg-info/psycopg2.egg-info/PKG-INFO

将顶级名称写入pip-egg-ps/psycopg2.egg-info/top_level.txt

将dependency_links写入pip-egg-info/psycopg2.egg-info/dependency_links.txt

警告:manifest_maker:找不到标准文件'-c'

错误:找不到pg_config可执行文件.

请将包含pg_config的目录添加到PATH

或使用以下选项指定完整的可执行文件路径:

python setup.py build_ext --pg-config/path/to/pg_config build ...

或者使用'setup.cfg'中的pg_config选项.


命令python setup.py egg_info失败,错误代码为1/Users/stevengerrits/build/psycopg2存储完整的登录/Users/stevengerrits/Library/Logs/pip.log

python postgresql macos psycopg2

32
推荐指数
10
解决办法
5万
查看次数

如何安装pg_config错误的psycopg2?

我已经尝试从此站点安装psycopg2(PostgreSQL数据库adapater),但是当我尝试将CD装入软件包并写入后进行安装时

python setup.py install 
Run Code Online (Sandbox Code Playgroud)

我收到以下错误:

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'.
Run Code Online (Sandbox Code Playgroud)

我也尝试过“ sudo pip install psycopg2”,并且得到了相同的消息。

阅读完文档后,它要求查看setup.cfg文件(如下):

[build_ext]
define=

# PSYCOPG_DISPLAY_SIZE enable display size calculation (a little slower)
# HAVE_PQFREEMEM should be defined on PostgreSQL >= 7.4
# PSYCOPG_DEBUG can be added to enable verbose debug information

# "pg_config" is …
Run Code Online (Sandbox Code Playgroud)

python postgresql psycopg2

11
推荐指数
5
解决办法
2万
查看次数

错误:无法在 ARM 默认前缀 (/opt/homebrew) 中的 Rosetta 2 下安装

我尝试用 Brew 升级

$ brew upgrade stripe/stripe-cli/stripe
Run Code Online (Sandbox Code Playgroud)

我有:

Error: Cannot install under Rosetta 2 in ARM default prefix (/opt/homebrew)!
To rerun under ARM use:
    arch -arm64 brew install ...
To install under x86_64, install Homebrew into /usr/local.

Run Code Online (Sandbox Code Playgroud)

按照建议,我尝试过

$ arch -arm64 brew install
Run Code Online (Sandbox Code Playgroud)

但得到:

Error: Invalid usage: This command requires at least 1 formula or cask argument.
Run Code Online (Sandbox Code Playgroud)

我尝试根据本教程安装 Rosetta 2

$ /usr/sbin/softwareupdate --install-rosetta --agree-to-license
Run Code Online (Sandbox Code Playgroud)

但我得到了:

Installing Rosetta 2 on this system is not supported.
Run Code Online (Sandbox Code Playgroud)

homebrew apple-m1

10
推荐指数
2
解决办法
4万
查看次数

如何修复错误“错误:命令错误,退出状态1:python。” 尝试使用pip安装django-heroku时

我正在尝试使用pip安装django-heroku,但它始终会遇到错误。

我已经看到建议告诉我确保我在heroku中的python版本是最新的建议。我已经做到了。推送到heroku master之后,我运行了install命令,但它给了我以下错误。

pip install django-heroku
Run Code Online (Sandbox Code Playgroud)

错误:

 ERROR: Command errored out with exit status 1:
 command: /Users/user/Dev/trydjango/new_env/bin/python -c 'import 
 sys, setuptools, tokenize; sys.argv[0] = 
 '"'"'/private/var/folders/xl/s533dc515qs8sd3tpg7y5ty80000gp/T/pip- 
 install-xqsix26g/psycopg2/setup.py'"'"'; 

egg_info --egg-base pip-egg-info
     cwd: 
/private/var/folders/xl/s533dc515qs8sd3tpg7y5ty80000gp/T/pip- 
install-xqsix26g/psycopg2/
Complete output (23 lines):
running egg_info
creating pip-egg-info/psycopg2.egg-info
writing pip-egg-info/psycopg2.egg-info/PKG-INFO
writing dependency_links to pip-egg-info/psycopg2.egg- 
info/dependency_links.txt
writing top-level names to pip-egg-info/psycopg2.egg- 
info/top_level.txt
writing manifest file 'pip-egg-info/psycopg2.egg-info/SOURCES.txt'

Error: pg_config executable not found.

pg_config is required to build psycopg2 from source.  Please add t .   he directory
containing pg_config to the …
Run Code Online (Sandbox Code Playgroud)

python django pip heroku

8
推荐指数
1
解决办法
6万
查看次数