pip3.6 install mysqlclient==1.3.12 失败并出现错误:未知类型名称“my_bool”;你的意思是“布尔”
Posted
技术标签:
【中文标题】pip3.6 install mysqlclient==1.3.12 失败并出现错误:未知类型名称“my_bool”;你的意思是“布尔”【英文标题】:pip3.6 install mysqlclient==1.3.12 fails with error: unknown type name ‘my_bool’; did you mean ‘bool 【发布时间】:2021-11-23 03:44:48 【问题描述】:我有一个项目在 ubuntu 16.04 和 python 3.6 上运行,但现在我们正试图让它在具有相同 python 版本的 ubuntu 20.04 上运行。我需要在 venv 上安装所有要求,显然它只有 mysqlclient==1.3.12 失败。
浏览了很多关于 *** 的文章,但似乎都没有解决问题。
pip3 install mysqlclient==1.3.12
出错Collecting mysqlclient==1.3.12
Using cached mysqlclient-1.3.12.tar.gz (89 kB)
Building wheels for collected packages: mysqlclient
Building wheel for mysqlclient (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /data/ci-dashboard/CI_Dashboard/ci_env/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-g3k3l9km/mysqlclient_82099315cb17439080ee5421b4adf991/setup.py'"'"'; __file__='"'"'/tmp/pip-install-g3k3l9km/mysqlclient_82099315cb17439080ee5421b4adf991/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-lpym4ape
cwd: /tmp/pip-install-g3k3l9km/mysqlclient_82099315cb17439080ee5421b4adf991/
Complete output (32 lines):
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.6
copying _mysql_exceptions.py -> build/lib.linux-x86_64-3.6
creating build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/__init__.py -> build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/compat.py -> build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/connections.py -> build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/converters.py -> build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/cursors.py -> build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/release.py -> build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/times.py -> build/lib.linux-x86_64-3.6/MySQLdb
creating build/lib.linux-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/__init__.py -> build/lib.linux-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.linux-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.linux-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.linux-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.linux-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.linux-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/REFRESH.py -> build/lib.linux-x86_64-3.6/MySQLdb/constants
running build_ext
building '_mysql' extension
creating build/temp.linux-x86_64-3.6
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fdebug-prefix-map=/build/python3.6-8I2qjE/python3.6-3.6.15=. -specs=/usr/share/dpkg/no-pie-compile.specs -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Dversion_info=(1,3,12,'final',0) -D__version__=1.3.12 -I/usr/include/mysql -I/data/ci-dashboard/CI_Dashboard/ci_env/include -I/usr/include/python3.6m -c _mysql.c -o build/temp.linux-x86_64-3.6/_mysql.o
_mysql.c: In function ‘_mysql_ConnectionObject_ping’:
_mysql.c:1894:3: error: unknown type name ‘my_bool’; did you mean ‘bool’?
1894 | my_bool recon = reconnect;
| ^~~~~~~
| bool
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for mysqlclient
Running setup.py clean for mysqlclient
Failed to build mysqlclient
Installing collected packages: mysqlclient
Running setup.py install for mysqlclient ... error
ERROR: Command errored out with exit status 1:
command: /data/ci-dashboard/CI_Dashboard/ci_env/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-g3k3l9km/mysqlclient_82099315cb17439080ee5421b4adf991/setup.py'"'"'; __file__='"'"'/tmp/pip-install-g3k3l9km/mysqlclient_82099315cb17439080ee5421b4adf991/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-47odftw8/install-record.txt --single-version-externally-managed --compile --install-headers /data/ci-dashboard/CI_Dashboard/ci_env/include/site/python3.6/mysqlclient
cwd: /tmp/pip-install-g3k3l9km/mysqlclient_82099315cb17439080ee5421b4adf991/
Complete output (32 lines):
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.6
copying _mysql_exceptions.py -> build/lib.linux-x86_64-3.6
creating build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/__init__.py -> build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/compat.py -> build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/connections.py -> build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/converters.py -> build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/cursors.py -> build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/release.py -> build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/times.py -> build/lib.linux-x86_64-3.6/MySQLdb
creating build/lib.linux-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/__init__.py -> build/lib.linux-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.linux-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.linux-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.linux-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.linux-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.linux-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/REFRESH.py -> build/lib.linux-x86_64-3.6/MySQLdb/constants
running build_ext
building '_mysql' extension
creating build/temp.linux-x86_64-3.6
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fdebug-prefix-map=/build/python3.6-8I2qjE/python3.6-3.6.15=. -specs=/usr/share/dpkg/no-pie-compile.specs -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Dversion_info=(1,3,12,'final',0) -D__version__=1.3.12 -I/usr/include/mysql -I/data/ci-dashboard/CI_Dashboard/ci_env/include -I/usr/include/python3.6m -c _mysql.c -o build/temp.linux-x86_64-3.6/_mysql.o
_mysql.c: In function ‘_mysql_ConnectionObject_ping’:
_mysql.c:1894:3: error: unknown type name ‘my_bool’; did you mean ‘bool’?
1894 | my_bool recon = reconnect;
| ^~~~~~~
| bool
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1: /data/ci-dashboard/CI_Dashboard/ci_env/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-g3k3l9km/mysqlclient_82099315cb17439080ee5421b4adf991/setup.py'"'"'; __file__='"'"'/tmp/pip-install-g3k3l9km/mysqlclient_82099315cb17439080ee5421b4adf991/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-47odftw8/install-record.txt --single-version-externally-managed --compile --install-headers /data/ci-dashboard/CI_Dashboard/ci_env/include/site/python3.6/mysqlclient Check the logs for full command output.
我的虚拟环境已经安装了这些库: pip3.6 冻结
aiomysql==0.0.20
alembic==1.1.0
appnope==0.1.2
APScheduler==3.5.3
asn1crypto==0.24.0
astroid==2.4.2
autopep8==1.5.4
backcall==0.2.0
bcrypt==3.1.4
beautifulsoup4==4.6.3
cachetools==4.1.1
certifi==2018.8.24
cffi==1.11.5
chardet==3.0.4
click==6.7
colorama==0.4.3
colorhash==1.0.2
configparser==3.7.1
confluent-kafka==1.2.0
cryptography==2.3.1
cssselect==1.0.3
decorator==4.4.2
dill==0.3.1.1
dominate==2.3.1
Flask==1.0.2
Flask-APScheduler==1.10.1
Flask-Bootstrap==3.3.7.1
Flask-HTTPAuth==4.1.0
flask-ldap3-login==0.9.16
Flask-Login==0.4.1
Flask-Migrate==2.5.2
Flask-Minify==0.18
Flask-MonitoringDashboard==3.1.0
Flask-MySQLdb==0.2.0
flask-profiler==1.8.1
flask-sqlacodegen==1.1.8
Flask-SQLAlchemy==2.3.2
Flask-SSLify==0.1.5
Flask-WTF==0.14.2
gevent==1.4.0
greenlet==0.4.15
gunicorn==19.9.0
htmlmin==0.1.12
idna==2.7
inflect==2.1.0
ipykernel==5.3.4
ipython==7.16.1
ipython-genutils==0.2.0
isort==5.4.2
itsdangerous==0.24
jedi==0.17.2
Jinja2==2.11.1
jsmin==2.2.2
jupyter-client==6.1.7
jupyter-core==4.6.3
kafka-python==1.4.7
kazoo==2.5.0
lazy-object-proxy==1.4.3
ldap3==2.5.2
lesscpy==0.14.0
lxml==4.2.5
Mako==1.1.0
MarkupSafe==1.0
mccabe==0.6.1
multi-key-dict==2.0.3
nest-asyncio==1.4.1
numpy==1.18.1
pandas==0.25.3
paramiko==2.4.2
parso==0.7.1
pbr==4.3.0
pexpect==4.8.0
pickleshare==0.7.5
ply==3.11
prompt-toolkit==3.0.7
psutil==5.7.2
ptyprocess==0.6.0
pyasn1==0.4.4
pyasn1-modules==0.2.4
pyclean==2.0.0
pycodestyle==2.6.0
pycparser==2.19
Pygments==2.7.1
pykafka==2.8.0
PyMySQL==0.9.2
PyNaCl==1.3.0
pyOpenSSL==19.0.0
pyquery==1.4.0
python-dateutil==2.7.3
python-editor==1.0.4
python-jenkins==1.2.1
pytz==2018.5
pyzmq==19.0.2
requests==2.19.1
scipy==1.5.2
simplejson==3.17.2
six==1.15.0
SQLAlchemy==1.2.7
tabulate==0.8.5
toml==0.10.1
tornado==6.0.4
traitlets==4.3.3
typed-ast==1.4.1
tzlocal==1.5.1
urllib3==1.23
visitor==0.1.3
wcwidth==0.2.5
Werkzeug==0.14.1
wrapt==1.12.1
WTForms==2.1
xxhash==1.4.3
【问题讨论】:
【参考方案1】:您正在使用旧的 mysqlclient
1.3.12 和新的 MySQL 8。您需要将 MySQL 降级到版本 5.6。或者你需要稍后使用mysqlclient
。
在 2017 年 12 月 21 日的提交 a2ebbd2
中修复了不兼容问题,因此您需要更新版本的 mysqlclient
。
mysqlclient
1.3.13 已于 2018 年 6 月 27 日发布。请试用或任何更高版本。
【讨论】:
谢谢...两种解决方案都有效以上是关于pip3.6 install mysqlclient==1.3.12 失败并出现错误:未知类型名称“my_bool”;你的意思是“布尔”的主要内容,如果未能解决你的问题,请参考以下文章
issue:Linux /opt/python36/bin/pip3.6 install mysqlclient报错:ERROR: Command errored out with exit(示例代码
ubuntu下使用pip3.6安装模块总是报ssl module in Python is not available的错误
ubuntu下使用pip3.6安装模块总是报ssl module in Python is not available的错误