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]
<string>: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;文章来源:https://www.toymoban.com/news/detail-701228.html
6、成功;文章来源地址https://www.toymoban.com/news/detail-701228.html
到了这里,关于python install install cx_Oracle失败问题解决的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!