TypeError: Descriptors cannot not be created directly与ImportError: urllib3 v2.0 only support OpenSSL

我安装的是paddle 11.2

python -m pip install paddlepaddle-gpu==2.1.2.post -f https://www.paddlepaddle.org.cn/whl/linux/mkl/avx/stable.html

错误TypeError: Descriptors cannot not be created directly

TypeError: Descriptors cannot not be created directly.
If this call came from a _pb2.py file, your generated code is out of date and must be regenerated with protoc >= 3.19.0.
If you cannot immediately regenerate your protos, some other possible workarounds are:
 1. Downgrade the protobuf package to 3.20.x or lower.
 2. Set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python (but this will use pure-Python parsing and will be much slower).

解决方法:

pip install protobuf==3.19.0
#或
pip install protobuf==3.20.0

错误ImportError: urllib3 v2.0 only support OpenSSL

 "urllib3 v2.0 only supports OpenSSL 1.1.1+, currently "
ImportError: urllib3 v2.0 only supports OpenSSL 1.1.1+, currently the 'ssl' module is 
compiled with 'OpenSSL 1.1.0h  27 Mar 2018'. See: https://github.com/urllib3/urllib3/issues/2168

原因分析和解决
        原因:requests包引入了urllib3,而新版本的urllib3 需要OpenSSL 1.1.1+以上版本,否则报错:ImportError: urllib3 v2.0 only supports OpenSSL 1.1.1+,currently the ‘ssl’ module is compiled with ‘OpenSSL 1.0.2k-fips 26 Jan 2017’. See: https://github.com/urllib3/urllib3/issues/2168,而且去官网查看的时候,发现对于1.1.1之前的版本已经不再支持了,所以需要安装新的版本用于支持。

 解决办法:

pip install urllib3==1.26.15

安装完之后就可以运行成功啦。

成功截图:

 安装sklearn包错误解决:pip install sklearn

error: subprocess-exited-with-error

  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [15 lines of output]
      The 'sklearn' PyPI package is deprecated, use 'scikit-learn'
      rather than 'sklearn' for pip commands.

      Here is how to fix this error in the main use cases:
      - use 'pip install scikit-learn' rather than 'pip install sklearn'
      - replace 'sklearn' by 'scikit-learn' in your pip requirements files
        (requirements.txt, setup.py, setup.cfg, Pipfile, etc ...)
      - if the 'sklearn' package is used by one of your dependencies,
        it would be great if you take some time to track which package uses
        'sklearn' instead of 'scikit-learn' and report it to their issue tracker
      - as a last resort, set the environment variable
        SKLEARN_ALLOW_DEPRECATED_SKLEARN_PACKAGE_INSTALL=True to avoid this error

      More information is available at
      https://github.com/scikit-learn/sklearn-pypi-package
      [end of output]

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

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

解决:
这个问题是因为你尝试安装名为"sklearn"的包,但实际上,现在应该使用名为"scikit-learn"的包。"sklearn"已被弃用,所以你需要使用正确的包名。以下是解决这个问题的方法:

使用正确的包名:
打开终端,运行以下命令来安装"scikit-learn"包:

pip install scikit-learn

这将安装正确的scikit-learn包,而不再使用"sklearn"。

更正依赖项文件:
如果你的项目中有依赖项文件,如requirements.txt、setup.py、setup.cfg、Pipfile等,确保在这些文件中将"sklearn"替换为"scikit-learn"。这样可以确保你的项目在构建时使用正确的包名。

设置环境变量:
如果你使用的是某个依赖项或工具,其内部引用了"sklearn"而不是"scikit-learn",你可以设置一个环境变量来解决这个问题。运行以下命令:

export SKLEARN_ALLOW_DEPRECATED_SKLEARN_PACKAGE_INSTALL=True

安装lap-0.4.0

进入这个网站下载 lap · PyPI

解压后执行 python setup.py install 

闲话:

哎!搞这个ai环境烦的要死过程太TM煎熬!!!

  • 7
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值