Python 3. 10. 12 PkgResourcesDeprecationWarning

新服务器环境部署基本完成了,但是在服务启动的时候出现了下面的错误:pkg_resources/__init__.py:116: PkgResourcesDeprecationWarning: 1.1build1 is an invalid version and will not be supported in a future release

完整错误信息:

lighthouse@VM-16-8-ubuntu:~/da-yi-ma-hou-tai$ gunicorn dayima_backend.wsgi:application --workers=4 --worker-class=gevent --bind=0.0.0.0:10086                                                  
[2024-02-27 15:08:15 +0800] [1631289] [INFO] Starting gunicorn 21.2.0
[2024-02-27 15:08:15 +0800] [1631289] [INFO] Listening at: http://0.0.0.0:10086 (1631289)
[2024-02-27 15:08:15 +0800] [1631289] [INFO] Using worker: gevent
[2024-02-27 15:08:15 +0800] [1631295] [INFO] Booting worker with pid: 1631295
[2024-02-27 15:08:15 +0800] [1631296] [INFO] Booting worker with pid: 1631296
[2024-02-27 15:08:15 +0800] [1631297] [INFO] Booting worker with pid: 1631297
[2024-02-27 15:08:15 +0800] [1631298] [INFO] Booting worker with pid: 1631298
/usr/lib/python3/dist-packages/pkg_resources/__init__.py:116: PkgResourcesDeprecationWarning: 1.1build1 is an invalid version and will not be supported in a future release
  warnings.warn(
/usr/lib/python3/dist-packages/pkg_resources/__init__.py:116: PkgResourcesDeprecationWarning: 0.1.43ubuntu1 is an invalid version and will not be supported in a future release
  warnings.warn(
/usr/lib/python3/dist-packages/pkg_resources/__init__.py:116: PkgResourcesDeprecationWarning: 1.1build1 is an invalid version and will not be supported in a future release
  warnings.warn(
/usr/lib/python3/dist-packages/pkg_resources/__init__.py:116: PkgResourcesDeprecationWarning: 0.1.43ubuntu1 is an invalid version and will not be supported in a future release
  warnings.warn(
/usr/lib/python3/dist-packages/pkg_resources/__init__.py:116: PkgResourcesDeprecationWarning: 1.1build1 is an invalid version and will not be supported in a future release
  warnings.warn(
/usr/lib/python3/dist-packages/pkg_resources/__init__.py:116: PkgResourcesDeprecationWarning: 0.1.43ubuntu1 is an invalid version and will not be supported in a future release
  warnings.warn(
/usr/lib/python3/dist-packages/pkg_resources/__init__.py:116: PkgResourcesDeprecationWarning: 1.1build1 is an invalid version and will not be supported in a future release
  warnings.warn(
/usr/lib/python3/dist-packages/pkg_resources/__init__.py:116: PkgResourcesDeprecationWarning: 0.1.43ubuntu1 is an invalid version and will not be supported in a future release
  warnings.warn(

搜索了一下,百度没找到什么有用的信息,于是饭前 google 了一下,发现了这个帖子:

https://askubuntu.com/questions/1406952/what-is-the-meaning-of-this-pkgresourcesdeprecationwarning-warning-from-pipenv

setuptools 的 bug,通过下面的命令降级即可:

pip install --upgrade --user setuptools==58.3.0

再次运行就 ok 了:

☆版权☆

* 网站名称:obaby@mars
* 网址:https://oba.by/
* 个性:https://oba.by/
* 本文标题: 《Python 3. 10. 12 PkgResourcesDeprecationWarning》
* 本文链接:https://zhongxiaojie.com/2024/02/15597
* 短链接:https://oba.by/?p=15597
* 转载文章请标明文章来源,原文标题以及原文链接。请遵从 《署名-非商业性使用-相同方式共享 2.5 中国大陆 (CC BY-NC-SA 2.5 CN) 》许可协议。


You may also like

8 comments

    1. 公主 Queen 
      Google Chrome 118 Google Chrome 118 Mac OS X 10.15 Mac OS X 10.15 cn山东省青岛市 联通

      后面需要用 crontab 执行一些定时任务,放 docker 里面反而不好做任务管理了。 kiss

  1.   Level 3
    Google Chrome 121 Google Chrome 121 Windows 10 Windows 10 cn江西省 移动/数据上网公共出口

    Python 版本不是越高越好 很多库跟不上版本

    1. 公主 Queen 
      Google Chrome 120 Google Chrome 120 Windows 10 Windows 10 cn山东省青岛市 联通

      并不是,相反很多项目反而依赖于低版本 例如 faceswap,stable diffusion之类的基于的python版本都不同,一般情况下我会用conda或者venv创建虚拟环境以支持多个不同版本的python。
      这个是生产环境一般就部署这一个项目,其他的也不会再往上部署了所有没有使用虚拟环境部署。

      1.   Level 3
        Google Chrome 121 Google Chrome 121 Windows 10 Windows 10 cn江西省 移动/数据上网公共出口

        哈哈哈哈你理解错了,我的意思是:Python 版本,不是越高越好 laugh

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注