psycopg2在Windows(PIP或WHEEL)(UNICODEDECODEERROR)上安装错误

发布于 2025-02-07 18:22:53 字数 6508 浏览 0 评论 0原文

我目前正在尝试使用PYPY尝试与Profiler一起查看,如果我将获得比现在更好的结果,目前仅使用Python 3.8,

我已经为Windows 10(64位)安装了Pypy 3.9,并且正在升级PIP,setuptools,作为setuptools,作为以及在安装任何内容之前的车轮一样,大多数软件包都可以正常工作(WebSockets,Google-auth,...),但是在安装AIOPG时(建于Psycopg2)时,我会遇到此错误:

pip install psycopg2
Collecting psycopg2
  Using cached psycopg2-2.9.3.tar.gz (380 kB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  Ôöé exit code: 1
  Ôò░ÔöÇ> [46 lines of output]
      running egg_info
      creating C:\Users\charl\AppData\Local\Temp\pip-pip-egg-info-slfqnpdw\psycopg2.egg-info
      writing C:\Users\charl\AppData\Local\Temp\pip-pip-egg-info-slfqnpdw\psycopg2.egg-info\PKG-INFO
      writing dependency_links to C:\Users\charl\AppData\Local\Temp\pip-pip-egg-info-slfqnpdw\psycopg2.egg-info\dependency_links.txt
      writing top-level names to C:\Users\charl\AppData\Local\Temp\pip-pip-egg-info-slfqnpdw\psycopg2.egg-info\top_level.txt
      writing manifest file 'C:\Users\charl\AppData\Local\Temp\pip-pip-egg-info-slfqnpdw\psycopg2.egg-info\SOURCES.txt'
      c:\pypy3.8-v7.3.8-win64\lib\site-packages\setuptools\config\setupcfg.py:459: SetuptoolsDeprecationWarning: The license_file parameter is deprecated, use license_files instead.
        warnings.warn(msg, warning_class)
      Traceback (most recent call last):
        File "<string>", line 36, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "C:\Users\charl\AppData\Local\Temp\pip-install-_oajyk5x\psycopg2_8ddd8ed44adb43868bba1fd17520cb9c\setup.py", line 572, in <module>
          'Download': 'https://pypi.org/project/psycopg2/',
        File "c:\pypy3.8-v7.3.8-win64\lib\site-packages\setuptools\__init__.py", line 87, in setup
          return distutils.core.setup(**attrs)
        File "c:\pypy3.8-v7.3.8-win64\lib\site-packages\setuptools\_distutils\core.py", line 177, in setup
          return run_commands(dist)
        File "c:\pypy3.8-v7.3.8-win64\lib\site-packages\setuptools\_distutils\core.py", line 193, in run_commands
          dist.run_commands()
        File "c:\pypy3.8-v7.3.8-win64\lib\site-packages\setuptools\_distutils\dist.py", line 968, in run_commands
          self.run_command(cmd)
        File "c:\pypy3.8-v7.3.8-win64\lib\site-packages\setuptools\dist.py", line 1229, in run_command
          super().run_command(command)
        File "c:\pypy3.8-v7.3.8-win64\lib\site-packages\setuptools\_distutils\dist.py", line 987, in run_command
          cmd_obj.run()
        File "c:\pypy3.8-v7.3.8-win64\lib\site-packages\setuptools\command\egg_info.py", line 308, in run
          self.find_sources()
        File "c:\pypy3.8-v7.3.8-win64\lib\site-packages\setuptools\command\egg_info.py", line 315, in find_sources
          mm.run()
        File "c:\pypy3.8-v7.3.8-win64\lib\site-packages\setuptools\command\egg_info.py", line 550, in run
          self.add_defaults()
        File "c:\pypy3.8-v7.3.8-win64\lib\site-packages\setuptools\command\egg_info.py", line 587, in add_defaults
          sdist.add_defaults(self)
        File "c:\pypy3.8-v7.3.8-win64\lib\site-packages\setuptools\_distutils\command\sdist.py", line 252, in add_defaults
          self._add_defaults_ext()
        File "c:\pypy3.8-v7.3.8-win64\lib\site-packages\setuptools\_distutils\command\sdist.py", line 336, in _add_defaults_ext
          build_ext = self.get_finalized_command('build_ext')
        File "c:\pypy3.8-v7.3.8-win64\lib\site-packages\setuptools\_distutils\cmd.py", line 304, in get_finalized_command
          cmd_obj.ensure_finalized()
        File "c:\pypy3.8-v7.3.8-win64\lib\site-packages\setuptools\_distutils\cmd.py", line 107, in ensure_finalized
          self.finalize_options()
        File "C:\Users\charl\AppData\Local\Temp\pip-install-_oajyk5x\psycopg2_8ddd8ed44adb43868bba1fd17520cb9c\setup.py", line 381, in finalize_options
          for token in pg_config_helper.query("ldflags").split():
        File "C:\Users\charl\AppData\Local\Temp\pip-install-_oajyk5x\psycopg2_8ddd8ed44adb43868bba1fd17520cb9c\setup.py", line 124, in query
          result = result.decode('ascii')
      UnicodeDecodeError: 'ascii' codec can't decode byte 0xe9 in position 13: ordinal not in range(128)
      [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.

我一直在尝试以下内容:

  • python with python with python with python 3.8:同样的错误,尽管清除了PIP缓存
  • “ PIP安装psycopg2-binary”:相同的错误
  • 降低psycopg2版本:相同的错误直到版本太低:另一个错误,原因是我的Python版本不存在
  • 下载WHL和WHL和安装“手动”:无法出于不同的原因工作:“ psycopg2-2.9.3-cp38-cp38-win_amd64.whl在此平台上不是支持的轮子。”尽管使用了Python X64 3.8:
pip -V
pip 22.1.2 from c:\pypy3.8-v7.3.8-win64\lib\site-packages\pip (python 3.8)

我已经尝试使用Asyncpg,因为它似乎是一个非常快的PostgreSQL库,我的服务器主要是由SQL请求制成的,我得到了:

asyncpg/protocol/record/recordobj.c(549): warning C4013: '_PyUnicodeWriter_Dealloc' non d\x82fini(e)\xff; extern retournant int pris par d\x82faut
     asyncpg/protocol/record/recordobj.c(549): error C2065: 'writer'\xff: identificateur non d\x82clar\x82
     C:\Users\charl\AppData\Local\Temp\pip-build-env-goboqejq\overlay\Lib\site-packages\setuptools\config\pyprojecttoml.py:123: _InvalidFile: The given `pyproject.toml` file is invalid and would be ignored.
         !!


         ############################
         # Invalid `pyproject.toml` #
         ############################

         Any configurations in `pyproject.toml` will be ignored.
         Please note that future releases of setuptools will halt the build process
         if an invalid file is given.

         To prevent setuptools from considering `pyproject.toml` please
         DO NOT include the `[project]` or `[tool.setuptools]` tables in your file.


     !!

       if _skip_bad_config(project_table, orig_setuptools_table, dist):
     error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30133\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
     [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.

Psycopg另一方面,但我不想使用它。

是否有类似问题的Windows朋友?

I am currently trying to make use of pypy to try and see with a profiler if I will get better results than now, currently using only python 3.8

I have installed pypy 3.9 for windows 10 (64 bits) and been upgrading pip, setuptools, as well as wheels before installing anything, most of packages have been working fine (websockets, google-auth, ...) but when installing aiopg (built on psycopg2) I get this error:

pip install psycopg2
Collecting psycopg2
  Using cached psycopg2-2.9.3.tar.gz (380 kB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  Ôöé exit code: 1
  Ôò░ÔöÇ> [46 lines of output]
      running egg_info
      creating C:\Users\charl\AppData\Local\Temp\pip-pip-egg-info-slfqnpdw\psycopg2.egg-info
      writing C:\Users\charl\AppData\Local\Temp\pip-pip-egg-info-slfqnpdw\psycopg2.egg-info\PKG-INFO
      writing dependency_links to C:\Users\charl\AppData\Local\Temp\pip-pip-egg-info-slfqnpdw\psycopg2.egg-info\dependency_links.txt
      writing top-level names to C:\Users\charl\AppData\Local\Temp\pip-pip-egg-info-slfqnpdw\psycopg2.egg-info\top_level.txt
      writing manifest file 'C:\Users\charl\AppData\Local\Temp\pip-pip-egg-info-slfqnpdw\psycopg2.egg-info\SOURCES.txt'
      c:\pypy3.8-v7.3.8-win64\lib\site-packages\setuptools\config\setupcfg.py:459: SetuptoolsDeprecationWarning: The license_file parameter is deprecated, use license_files instead.
        warnings.warn(msg, warning_class)
      Traceback (most recent call last):
        File "<string>", line 36, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "C:\Users\charl\AppData\Local\Temp\pip-install-_oajyk5x\psycopg2_8ddd8ed44adb43868bba1fd17520cb9c\setup.py", line 572, in <module>
          'Download': 'https://pypi.org/project/psycopg2/',
        File "c:\pypy3.8-v7.3.8-win64\lib\site-packages\setuptools\__init__.py", line 87, in setup
          return distutils.core.setup(**attrs)
        File "c:\pypy3.8-v7.3.8-win64\lib\site-packages\setuptools\_distutils\core.py", line 177, in setup
          return run_commands(dist)
        File "c:\pypy3.8-v7.3.8-win64\lib\site-packages\setuptools\_distutils\core.py", line 193, in run_commands
          dist.run_commands()
        File "c:\pypy3.8-v7.3.8-win64\lib\site-packages\setuptools\_distutils\dist.py", line 968, in run_commands
          self.run_command(cmd)
        File "c:\pypy3.8-v7.3.8-win64\lib\site-packages\setuptools\dist.py", line 1229, in run_command
          super().run_command(command)
        File "c:\pypy3.8-v7.3.8-win64\lib\site-packages\setuptools\_distutils\dist.py", line 987, in run_command
          cmd_obj.run()
        File "c:\pypy3.8-v7.3.8-win64\lib\site-packages\setuptools\command\egg_info.py", line 308, in run
          self.find_sources()
        File "c:\pypy3.8-v7.3.8-win64\lib\site-packages\setuptools\command\egg_info.py", line 315, in find_sources
          mm.run()
        File "c:\pypy3.8-v7.3.8-win64\lib\site-packages\setuptools\command\egg_info.py", line 550, in run
          self.add_defaults()
        File "c:\pypy3.8-v7.3.8-win64\lib\site-packages\setuptools\command\egg_info.py", line 587, in add_defaults
          sdist.add_defaults(self)
        File "c:\pypy3.8-v7.3.8-win64\lib\site-packages\setuptools\_distutils\command\sdist.py", line 252, in add_defaults
          self._add_defaults_ext()
        File "c:\pypy3.8-v7.3.8-win64\lib\site-packages\setuptools\_distutils\command\sdist.py", line 336, in _add_defaults_ext
          build_ext = self.get_finalized_command('build_ext')
        File "c:\pypy3.8-v7.3.8-win64\lib\site-packages\setuptools\_distutils\cmd.py", line 304, in get_finalized_command
          cmd_obj.ensure_finalized()
        File "c:\pypy3.8-v7.3.8-win64\lib\site-packages\setuptools\_distutils\cmd.py", line 107, in ensure_finalized
          self.finalize_options()
        File "C:\Users\charl\AppData\Local\Temp\pip-install-_oajyk5x\psycopg2_8ddd8ed44adb43868bba1fd17520cb9c\setup.py", line 381, in finalize_options
          for token in pg_config_helper.query("ldflags").split():
        File "C:\Users\charl\AppData\Local\Temp\pip-install-_oajyk5x\psycopg2_8ddd8ed44adb43868bba1fd17520cb9c\setup.py", line 124, in query
          result = result.decode('ascii')
      UnicodeDecodeError: 'ascii' codec can't decode byte 0xe9 in position 13: ordinal not in range(128)
      [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.

I have been trying the following:

  • Pypy 3.8 with python 3.8 : same error despite clearing pip cache
  • "pip install psycopg2-binary" : same error
  • downgrading psycopg2 version : same error until the version is too low : another error due to the fact that the package doesnt exist for my python version
  • downloading the whl and installing "manually" : not working for different reason : "psycopg2-2.9.3-cp38-cp38-win_amd64.whl is not a supported wheel on this platform." despite using python x64 3.8 :
pip -V
pip 22.1.2 from c:\pypy3.8-v7.3.8-win64\lib\site-packages\pip (python 3.8)

I've tried using asyncpg since it seems like a really fast postgresql library and my server is mostly made of sql requests and I got :

asyncpg/protocol/record/recordobj.c(549): warning C4013: '_PyUnicodeWriter_Dealloc' non d\x82fini(e)\xff; extern retournant int pris par d\x82faut
     asyncpg/protocol/record/recordobj.c(549): error C2065: 'writer'\xff: identificateur non d\x82clar\x82
     C:\Users\charl\AppData\Local\Temp\pip-build-env-goboqejq\overlay\Lib\site-packages\setuptools\config\pyprojecttoml.py:123: _InvalidFile: The given `pyproject.toml` file is invalid and would be ignored.
         !!


         ############################
         # Invalid `pyproject.toml` #
         ############################

         Any configurations in `pyproject.toml` will be ignored.
         Please note that future releases of setuptools will halt the build process
         if an invalid file is given.

         To prevent setuptools from considering `pyproject.toml` please
         DO NOT include the `[project]` or `[tool.setuptools]` tables in your file.


     !!

       if _skip_bad_config(project_table, orig_setuptools_table, dist):
     error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30133\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
     [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.

psycopg on the other hand worked, but I don't want to use it.

Any fellow windows friend having similar problems?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文