You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

CentOS7下Python3.6无法使用pyodbc及安装冲突问题求助

解决CentOS7下Python3.6缺失pyodbc及yum包冲突问题

Hey there, let's work through your Python3.6 issues step by step—you've got two main problems here: the missing pyodbc module for Python3.6, and the pip package conflict when trying to install python3-devel. Here's how to fix both:

1. Fix the yum pip package conflict

The error happens because the system-provided python3-pip package conflicts with the python36u-pip you installed from the IUS repo. You have two options here:

Option 1: Remove the conflicting IUS pip package

If you don't need to keep python36u-pip, uninstall it first then install python3-devel:

sudo yum remove python36u-pip
sudo yum install python3-devel

Option 2: Skip the conflicting system pip package during installation

If you want to keep python36u-pip, tell yum to exclude the system's python3-pip when installing python3-devel:

sudo yum install python3-devel --exclude=python3-pip

2. Install pyodbc specifically for Python3.6

The pyodbc you installed earlier was set up for Python2.7—Python3.6 needs its own separate installation. Try these methods:

Method 1: Use pip3.6 (the easiest way)

First make sure your Python3.6's pip is working. If you removed python36u-pip earlier, reinstall it:

sudo yum install python36u-pip
# Now install pyodbc with pip3.6
sudo pip3.6 install pyodbc

Method 2: Compile from source (if pip fails)

If pip runs into dependency issues, compile pyodbc manually:

  1. Install the required build tools and dependencies:
sudo yum install gcc-c++ unixODBC-devel
  1. Grab the pyodbc source code (pick a version compatible with Python3.6—4.0.39 works well):
curl -O https://files.pythonhosted.org/packages/source/p/pyodbc/pyodbc-4.0.39.tar.gz
tar xzf pyodbc-4.0.39.tar.gz
cd pyodbc-4.0.39
  1. Build and install using Python3.6:
python3.6 setup.py build
sudo python3.6 setup.py install

3. Verify everything works

Check if Python3.6 can find pyodbc:

python3.6 -c "import pyodbc; print('Success! pyodbc version:', pyodbc.version)"

If that outputs a version number without errors, you're good to run your script:

python3.6 myscript.py

内容的提问来源于stack exchange,提问作者vidiv

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.07 19:07:53