无法在 M1 Mac 上使用 pip3 安装 psycopg2

2024-02-18

我无法在我的 M1 Mac 上安装 psycopg2,并且我使用了 pip3。

当我尝试安装时pip3 install psycopg2输出是这样的:

  ERROR: Command errored out with exit status 1:
     command: /opt/homebrew/opt/[email protected] /cdn-cgi/l/email-protection/bin/python3.9 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/m5/vhnyyjg16gd352x6wdhpjysh0000gn/T/pip-install-9wiqe2nr/psycopg2_147a5ae8fd5a47079480274f4225edbf/setup.py'"'"'; __file__='"'"'/private/var/folders/m5/vhnyyjg16gd352x6wdhpjysh0000gn/T/pip-install-9wiqe2nr/psycopg2_147a5ae8fd5a47079480274f4225edbf/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 /private/var/folders/m5/vhnyyjg16gd352x6wdhpjysh0000gn/T/pip-pip-egg-info-06hnnl2t
         cwd: /private/var/folders/m5/vhnyyjg16gd352x6wdhpjysh0000gn/T/pip-install-9wiqe2nr/psycopg2_147a5ae8fd5a47079480274f4225edbf/
    Complete output (23 lines):
    running egg_info
    creating /private/var/folders/m5/vhnyyjg16gd352x6wdhpjysh0000gn/T/pip-pip-egg-info-06hnnl2t/psycopg2.egg-info
    writing /private/var/folders/m5/vhnyyjg16gd352x6wdhpjysh0000gn/T/pip-pip-egg-info-06hnnl2t/psycopg2.egg-info/PKG-INFO
    writing dependency_links to /private/var/folders/m5/vhnyyjg16gd352x6wdhpjysh0000gn/T/pip-pip-egg-info-06hnnl2t/psycopg2.egg-info/dependency_links.txt
    writing top-level names to /private/var/folders/m5/vhnyyjg16gd352x6wdhpjysh0000gn/T/pip-pip-egg-info-06hnnl2t/psycopg2.egg-info/top_level.txt
    writing manifest file '/private/var/folders/m5/vhnyyjg16gd352x6wdhpjysh0000gn/T/pip-pip-egg-info-06hnnl2t/psycopg2.egg-info/SOURCES.txt'
    
    Error: pg_config executable not found.
    
    pg_config is required to build psycopg2 from source.  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'.
    
    If you prefer to avoid building psycopg2 from source, please install the PyPI
    'psycopg2-binary' package instead.
    
    For further information please check the 'doc/src/install.rst' file (also at
    <https://www.psycopg.org/docs/install.html>).
    
    ----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/fd/ae/98cb7a0cbb1d748ee547b058b14604bd0e9bf285a8e0cc5d148f8a8a952e/psycopg2-2.8.6.tar.gz#sha256=fb23f6c71107c37fd667cb4ea363ddeb936b348bbd6449278eb92c189699f543 (from https://pypi.org/simple/psycopg2/) (requires-python:>=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
  Using cached psycopg2-2.8.5.tar.gz (380 kB)
    ERROR: Command errored out with exit status 1:
     command: /opt/homebrew/opt/[email protected] /cdn-cgi/l/email-protection/bin/python3.9 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/m5/vhnyyjg16gd352x6wdhpjysh0000gn/T/pip-install-9wiqe2nr/psycopg2_97efcf6747c249769acdc8430ba4238f/setup.py'"'"'; __file__='"'"'/private/var/folders/m5/vhnyyjg16gd352x6wdhpjysh0000gn/T/pip-install-9wiqe2nr/psycopg2_97efcf6747c249769acdc8430ba4238f/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 /private/var/folders/m5/vhnyyjg16gd352x6wdhpjysh0000gn/T/pip-pip-egg-info-ap2am61r
         cwd: /private/var/folders/m5/vhnyyjg16gd352x6wdhpjysh0000gn/T/pip-install-9wiqe2nr/psycopg2_97efcf6747c249769acdc8430ba4238f/
    Complete output (23 lines):
    running egg_info
    creating /private/var/folders/m5/vhnyyjg16gd352x6wdhpjysh0000gn/T/pip-pip-egg-info-ap2am61r/psycopg2.egg-info
    writing /private/var/folders/m5/vhnyyjg16gd352x6wdhpjysh0000gn/T/pip-pip-egg-info-ap2am61r/psycopg2.egg-info/PKG-INFO
    writing dependency_links to /private/var/folders/m5/vhnyyjg16gd352x6wdhpjysh0000gn/T/pip-pip-egg-info-ap2am61r/psycopg2.egg-info/dependency_links.txt
    writing top-level names to /private/var/folders/m5/vhnyyjg16gd352x6wdhpjysh0000gn/T/pip-pip-egg-info-ap2am61r/psycopg2.egg-info/top_level.txt
    writing manifest file '/private/var/folders/m5/vhnyyjg16gd352x6wdhpjysh0000gn/T/pip-pip-egg-info-ap2am61r/psycopg2.egg-info/SOURCES.txt'
    
    Error: pg_config executable not found.
    
    pg_config is required to build psycopg2 from source.  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'.
    
    If you prefer to avoid building psycopg2 from source, please install the PyPI
    'psycopg2-binary' package instead.
    
    For further information please check the 'doc/src/install.rst' file (also at
    <https://www.psycopg.org/docs/install.html>).
    ==============================================================================
    Its beginning of the error, After that its tried to install each previous version of Psycopg 
    ==============================================================================

另外,我尝试使用源代码安装:

克隆https://github.com/psycopg/psycopg2.git https://github.com/psycopg/psycopg2.git
cd psycopg2
python3 setup.py 构建

它的返回错误如下:

running build
running build_py
running build_ext

Error: pg_config executable not found.

pg_config is required to build psycopg2 from source.  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'.

If you prefer to avoid building psycopg2 from source, please install the PyPI
'psycopg2-binary' package instead.

For further information please check the 'doc/src/install.rst' file (also at
<https://www.psycopg.org/docs/install.html>).

Also
python3 setup.py 构建 返回与以下相同的错误python3 setup.py build

我该如何安装它?


尝试这个:

brew install libpq --build-from-source
brew install openssl

export LDFLAGS="-L/opt/homebrew/opt/[email protected] /cdn-cgi/l/email-protection/lib -L/opt/homebrew/opt/libpq/lib"
export CPPFLAGS="-I/opt/homebrew/opt/[email protected] /cdn-cgi/l/email-protection/include -I/opt/homebrew/opt/libpq/include"

pip3 install psycopg2
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

无法在 M1 Mac 上使用 pip3 安装 psycopg2 的相关文章

随机推荐

  • 我可以使用 ASP.NET 进行“WAR 文件”类型部署吗?

    有时精通 J2EE 的人看到 ASP NET 时会想 将应用程序部署为单个单元的支持在哪里 JSP Servlet 应用程序可以部署为 WAR 文件 所有页面 内容 元数据和代码都位于单个存档中 war 文件可以进行版本控制 可以轻松移动
  • 应用程序在 jdbcTemplate 中随机挂起进行更新

    我在用simpleJdbcTemplateSpring 使用如下所示的查询执行更新 update TABLE B JOIN select Column1 from TABLE A C ON B Column2 C Column3 set B
  • 创建跨域的cookie

    我正在研究饼干 我能够非常轻松地创建cookie 要创建 cookie 我使用以下代码 HttpCookie aCookie new HttpCookie Cookie name aCookie Value Value Response C
  • Dart 错误:Dart_LookupLibrary:未找到库“package:home_widget/home_widget_callback_dispatcher.dart”

    一个很奇怪的问题 我在用https pub dev packages home widget https pub dev packages home widget我正在尝试使用 backgroundCallback 通过按小部件上的图像来刷
  • RTMP中是如何包含flv格式的?

    我正在使用 Wireshark 来检查数据包 但我对 RTMP 流媒体中如何遵循 flv 格式感到困惑 FLV 文档指定标签为 标签类型 数据大小 时间戳 时间戳扩展 streamID VideoTagHeader 但我得到 fmt tim
  • 使用 wkhtmltopdf 设置横向方向

    我如何改变我的方向pdf生成的文件Wkhtmltopdf 我在 PHP 中调用它 如下所示 file fopen tmp html pdfTmp numRand html w or exit Unable to open file fwri
  • 如何从 File#path 获取 utf8 字符

    File path给我 Latin 1 字符 有没有办法让它给我 utf8 字符 或者我应该转换它返回的内容 如果是这样 最好 最简单的转换方法是什么 阐述 所以 我知道我可以这样做 Iconv new UTF 8 LATIN1 iconv
  • 如何将自定义验证器与 dropwizard 一起使用?

    我有一个由其他人编写的 REST api 其中处理对特定 url 的请求的方法接受一堆从路径参数填充的参数 POST Path classid studentid details Consumes MediaType MULTIPART F
  • 将 MySQL ANSI 输入转换为 UTF-8 [重复]

    这个问题在这里已经有答案了 我决定将我的网络应用程序从 ANSI 切换为 UTF 8 在 Notepad 中转换我的硬编码文件的编码后 这会执行转换 不仅仅是更改字符集 并为 UTF 8 设置新的元标记 我现在需要转换我的数据库数据 该数据
  • 从 Rails 控制器访问资产路径

    我正在共享一个配置 yml 文件客户端 我还需要在服务器端加载它 我已将其放置在 app assets javascripts configuration yml 中 我可以在视图内使用 asset path configuration y
  • 是否可以使用 JavaScript 触发键盘按钮?

    是否可以使用 JavaScript 触发键盘按钮 并根据 Caps Lock 按钮获取输入大小写 因此 如果我的大写锁定打开 它应该是大写的 或 如果它关闭了 它应该是小写的 触发关键事件 var ev jQuery Event keypr
  • 无法读取 C 中的某些注册表项

    我正在使用 RegOpenKeyEx 和 RegQueryValueEx 尝试获取 Windows 注册表中六个键的值 我能够完成六项中的四项 但在某些其他方面却失败了 wchar t getRegKeyValue HKEY rootKey
  • iOS7 中检测 MKOverlay 的触摸(MKOverlayRenderer)

    我有一个 MKMapView 可能绘制了数百个多边形 在 iOS7 上将 MKPolygon 和 MKPolygonRenderer 作为一个使用 我需要的是一种对用户触摸其中一个多边形进行操作的方法 例如 它们代表地图上具有一定人口密度的
  • 研究具有标准编码风格的优势

    Locked 这个问题及其答案是locked help locked posts因为这个问题是题外话 但却具有历史意义 目前不接受新的答案或互动 Stackoverflow 上有几个问题 关于是否有任何关于什么是最佳编码约定 风格的研究 这
  • 当闭源 CocoaPod 依赖于其他 pod 时,如何为它创建 XCFramework

    我正在寻找创建一个闭源 CocoaPod 根据我的研究 建议似乎是将其作为 XCFramework 分发 source https stackoverflow com a 66459296 1795356 似乎还可以通过在 Podspec
  • AngularJS - POST 后刷新

    在 Angular 中发出 http POST 请求后刷新内容的正确方法是什么 controller js var hudControllers angular module hudControllers hudControllers co
  • Postgres:授予角色/用户对由不同角色/用户创建的未来表的访问权限

    我正在构建一个 Spring Boot 应用程序 Flyway 数据库迁移在应用程序启动时执行 我决定使用两个不同的角色 角色 app 读 写表的权限 序列的权限app模式 和角色 迁移 advanced的权利app 移民模式 Flyway
  • 如何使用 Dropbox API v2 重命名文件

    我想使用 HTTP API 重命名 Dropbox 上的文件 根据新文档 可以移动 但不能重命名 https www dropbox com developers documentation http documentation files
  • 全页水平滚动问题

    整页滚动还有其他替代方案吗 整页滚动的示例 http jscrollpane kelvinluck com fullpage scroll html http jscrollpane kelvinluck com fullpage scro
  • 无法在 M1 Mac 上使用 pip3 安装 psycopg2

    我无法在我的 M1 Mac 上安装 psycopg2 并且我使用了 pip3 当我尝试安装时pip3 install psycopg2输出是这样的 ERROR Command errored out with exit status 1 c