python install install cx

1、问题背景:在本地机安装失败,但在服务器上安装成功;

2、环境对比:两个机器的python版本不一致;

报错如下:

PS C:\Users\Administrator\Downloads\***\****> pip install cx_Oracle                     

Collecting cx_Oracle

  Using cached cx_Oracle-8.3.0.tar.gz (363 kB)

  Installing build dependencies … done

  Getting requirements to build wheel … done

  Preparing metadata (pyproject.toml) … done

Building wheels for collected packages: cx_Oracle

  Building wheel for cx_Oracle (pyproject.toml) … error

  error: subprocess-exited-with-error

  × Building wheel for cx_Oracle (pyproject.toml) did not run successfully.

  │ exit code: 1

  ╰─> [8 lines of output]

      :6: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html

      C:\Users\Administrator\AppData\Local\Temp\pip-build-env-ln3m6cfk\overlay\Lib\site-packages\setuptools\config\expand.py:132: SetuptoolsWarning: File ‘C:\\Users\\Administrator\\App

Data\\Local\\Temp\\pip-install-2wg9p419\\cx-oracle_98b8bf5eb5fa4484a6701af7d917a7e2\\README.md’ cannot be found

        return ‘\n’.join(

      running bdist_wheel

      running build

      running build_ext

      building ‘cx_Oracle’ extension

      error: Microsoft Visual C++ 14.0 or greater is required. Get it with “Microsoft C++ Build Tools”: https://visualstudio.microsoft.com/visual-cpp-build-tools/

      [end of output]

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

  ERROR: Failed building wheel for cx_Oracle

Failed to build cx_Oracle

ERROR: Could not build wheels for cx_Oracle, which is required to install pyproject.toml-based projects

[notice] A new release of pip is available: 23.1.2 -> 23.2.1

[notice] To update, run: python.exe -m pip install –upgrade pip

PS C:\Users\Administrator\Downloads\bayonetProjectApi\bayonetProjectApi> 

 

解决方案:

1、进入cx-Oracle · Pyshou 手动去下载whl依赖,发现没有自己的python对于的文件(原因:可能自己安装的版本过高,导致依赖文件没有,所以失败);

2、重新安装和服务器上一致的python版本(3.7.9);

3、再次执行:pip3 install cx_Oracle ;

4、【如未遇到则忽略此步骤】报错:WARNING: You are using pip version 20.1.1; however, version 23.2.1 is available.

You should consider upgrading via the ‘d:\warfile\python\python.exe -m pip install –upgrade pip’ command(解决办法,执行:python -m pip install -U –force-reinstall pip);

5、再次执行:pip3 install cx_Oracle;

6、成功;

本文来自网络,不代表协通编程立场,如若转载,请注明出处:https://net2asp.com/0f471af0fd.html