【问题标题】:Getting error while installing CX_ORACLE in cmd在 cmd 中安装 CX_ORACLE 时出错
【发布时间】:2019-01-29 04:40:30
【问题描述】:

当我尝试在 Windows 10 中通过 cmd 安装 cx_Oracle 时出现以下错误。当我第一次尝试安装时,它要求我安装 MS Visual C++ 14 并设置 PATH 并最终显示在命令提示符。

由于环境错误而无法安装软件包

C:\Users\Dell>pip install cx_Oracle==5.1.3
Collecting cx_Oracle==5.1.3
  Using cached https://files.pythonhosted.org/packages/be/25/afc07a79ed268f6ab2e8959cfcff997504ce09500b881a1d93f92904762e/cx_Oracle-5.1.3.tar.gz
Error checking for conflicts.
Traceback (most recent call last):
  File "c:\users\dell\appdata\local\programs\python\python37-32\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 2897, in _dep_map
    return self.__dep_map
  File "c:\users\dell\appdata\local\programs\python\python37-32\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 2691, in __getattr__
    raise AttributeError(attr)
AttributeError: _DistInfoDistribution__dep_map

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\users\dell\appdata\local\programs\python\python37-32\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 2888, in _parsed_pkg_info
    return self._pkg_info
  File "c:\users\dell\appdata\local\programs\python\python37-32\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 2691, in __getattr__
    raise AttributeError(attr)
AttributeError: _pkg_info

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\users\dell\appdata\local\programs\python\python37-32\lib\site-packages\pip\_internal\commands\install.py", line 503, in _warn_about_conflicts
    package_set, _dep_info = check_install_conflicts(to_install)
  File "c:\users\dell\appdata\local\programs\python\python37-32\lib\site-packages\pip\_internal\operations\check.py", line 108, in check_install_conflicts
    package_set, _ = create_package_set_from_installed()
  File "c:\users\dell\appdata\local\programs\python\python37-32\lib\site-packages\pip\_internal\operations\check.py", line 47, in create_package_set_from_installed
    package_set[name] = PackageDetails(dist.version, dist.requires())
  File "c:\users\dell\appdata\local\programs\python\python37-32\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 2635, in requires
    dm = self._dep_map
  File "c:\users\dell\appdata\local\programs\python\python37-32\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 2899, in _dep_map
    self.__dep_map = self._compute_dependencies()
  File "c:\users\dell\appdata\local\programs\python\python37-32\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 2908, in _compute_dependencies
    for req in self._parsed_pkg_info.get_all('Requires-Dist') or []:
  File "c:\users\dell\appdata\local\programs\python\python37-32\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 2890, in _parsed_pkg_info
    metadata = self.get_metadata(self.PKG_INFO)
  File "c:\users\dell\appdata\local\programs\python\python37-32\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 1410, in get_metadata
    value = self._get(self._fn(self.egg_info, name))
  File "c:\users\dell\appdata\local\programs\python\python37-32\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 1522, in _get
    with open(path, 'rb') as stream:
FileNotFoundError: [Errno 2] No such file or directory: 'c:\\users\\dell\\appdata\\local\\programs\\python\\python37-32\\lib\\site-packages\\cx_oracle-7.0.0.dist-info\\METADATA'
Installing collected packages: cx-Oracle
  Found existing installation: cx-oracle 7.0.0
Could not install packages due to an EnvironmentError: [Errno 2] No such file or directory: 'c:\\users\\dell\\appdata\\local\\programs\\python\\python37-32\\lib\\site-packages\\cx_oracle-7.0.0.dist-info\\RECORD'

我正在安装 cx_Oracle 以在 Django 和 Oracle 数据库之间建立连接。

【问题讨论】:

    标签: python cx-oracle


    【解决方案1】:

    不要安装 cx_Oracle 5.1.3,它现在已经很老了,可能无法与 Python 3.7 一起正常工作,只需安装 cx_Oracle 而不指定版本:

    pip install cx_Oracle
    

    这应该让您获得 cx_Oracle 7 并为您提供预编译的二进制文件,因此您也不必担心获得编译器!

    【讨论】:

    • 感谢您的支持#Anthony Tuininga,是的,我也试过了。我收到类似“要求已经满足:c:\users\dell\appdata\local\programs\python\python37-32\lib\site-packages (7.0.0) NO METADATA IN c:\users 中的 cx_Oracle \dell\appdata\local\programs\python\python37-32\lib\site-packages dell\appdata\local\programs\python\python37-32\lib\site-packages (7.0.0)”。有没有其他办法...?
    • 通过谷歌:试试pip install --upgrade --force-reinstall cx_Oracle
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-01-24
    • 2017-09-10
    • 1970-01-01
    • 1970-01-01
    • 2020-12-08
    • 2016-01-27
    • 1970-01-01
    相关资源
    最近更新 更多