[英]UnicodeDecodeerror with pip install pyodbc
Trying to install pyodbc: pip install pyodbc
it got the following error. 尝试安装pyodbc:
pip install pyodbc
出现以下错误。 I install a different item peewee
specifically and it install without giving me error. 我专门安装了另一个项目
peewee
,并且安装时没有给我错误。 I further tried with pip install pymssql
and it also came with a similar error. 我进一步尝试了
pip install pymssql
,它也出现了类似的错误。 I am familiar with pyodbc
and would like to use it in my flask app. 我熟悉
pyodbc
并想在我的flask应用中使用它。
Anyone with an idea how i can overcome this error. 任何有想法我如何克服这个错误的人。
i followed UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 13: ordinal not in range(128) , How to fix: "UnicodeDecodeError: 'ascii' codec can't decode byte" but could not solve the problem. 我遵循UnicodeDecodeError:'ascii'编解码器无法解码位置13的字节0xe2:序数不在range(128)中 , 如何解决:“ UnicodeDecodeError:'ascii'编解码器无法解码字节”,但无法解决问题。
I am using ubuntu 14.05. 我正在使用Ubuntu 14.05。
pip install pyodbc
Downloading/unpacking pyodbc
Downloading pyodbc-3.0.10.tar.gz (68kB): 68kB downloaded
Running setup.py (path:/tmp/pip-build-xNSuOb/pyodbc/setup.py) egg_info for package pyodbc
warning: no files found matching 'tests/*'
warning: no files found matching 'README.rst'
Installing collected packages: pyodbc
Running setup.py install for pyodbc
building 'pyodbc' extension
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall - Wstrict-prototypes -fno-strict-aliasing -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC - DPYODBC_VERSION=3.0.10 -DPYODBC_UNICODE_WIDTH=4 -DSQL_WCHART_CONVERT=1 -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/include -I/usr/include/python2.7 -c /tmp/pip-build-xNSuOb/pyodbc/src/params.cpp -o build/temp.linux-x86_64-2.7/tmp/pip-build-xNSuOb/pyodbc/src/params.o -Wno-write-strings
x86_64-linux-gnu-gcc: error: unrecognized command line option ‘-fstack-protector-strong’
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
Complete output from command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-xNSuOb/pyodbc/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-GvPtxS-record/install-record.txt --single-version-externally-managed --compile --user:
running install
running build
running build_ext
building 'pyodbc' extension
creating build
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/tmp
creating build/temp.linux-x86_64-2.7/tmp/pip-build-xNSuOb
creating build/temp.linux-x86_64-2.7/tmp/pip-build-xNSuOb/pyodbc
creating build/temp.linux-x86_64-2.7/tmp/pip-build-xNSuOb/pyodbc/src
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict- prototypes -fno-strict-aliasing -D_FORTIFY_SOURCE=2 -g -fstack-protector- strong -Wformat -Werror=format-security -fPIC -DPYODBC_VERSION=3.0.10 - DPYODBC_UNICODE_WIDTH=4 -DSQL_WCHART_CONVERT=1 - I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/include -I/usr/include/python2.7 -c /tmp/pip-build-xNSuOb/pyodbc/src/params.cpp -o build/temp.linux-x86_64-2.7/tmp/pip-build-xNSuOb/pyodbc/src/params.o -Wno-write-strings
x86_64-linux-gnu-gcc: error: unrecognized command line option ‘- fstack-protector-strong’
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
Cleaning up...
Command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build- xNSuOb/pyodbc/setup.py';exec(compile(getattr(tokenize, 'open', open) (__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install -- record /tmp/pip-GvPtxS-record/install-record.txt --single-version- externally-managed --compile --user failed with error code 1 in /tmp/pip- build-xNSuOb/pyodbc
Traceback (most recent call last):
File "/usr/bin/pip", line 9, in <module>
load_entry_point('pip==1.5.6', 'console_scripts', 'pip')()
File "/usr/lib/python2.7/dist-packages/pip/__init__.py", line 248, in main
return command.main(cmd_args)
File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 161, in main
text = '\n'.join(complete_log)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 66: ordinal not in range(128)
Most likely the problem is ancient pip you are using - 1.5.6. 问题最可能是您使用的古老点-1.5.6。 Upgrade it to the latest with
pip install -U pip
and check again. 使用
pip install -U pip
将其升级到最新版本,然后再次检查。
Also, make sure that python-devel is installed. 另外,请确保已安装python-devel。
Thanks for the Help. 谢谢您的帮助。 A friend on one slack page help me through it.
一个松弛页面上的一个朋友可以帮助我。
export LC_ALL=C
this would make pip use the local configuration within the operating system. export LC_ALL=C
这将使pip使用操作系统内的本地配置。 pip install --upgrade setuptools
pip install --upgrade setuptools
pip install pyodbc
again and have the following error But no longer the ascii
issue pip install pyodbc
再次pip install pyodbc
并出现以下错误, 但不再是ascii
问题 fatal error: sql.h: No such file or directory #include <sql.h> ^compilation terminated.error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
We then figured out the second problem to be with gcc compiler since pyodbc was written in C. fatal error: sql.h: No such file or directory #include <sql.h> ^compilation terminated.error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
然后我们找出了第二个问题因为pyodbc是用C编写的,所以是gcc编译器。
And this finally this solved it 这终于解决了
4.run sudo apt-get install unixodbc-dev && sudo apt-get install pyodbc
4.运行
sudo apt-get install unixodbc-dev && sudo apt-get install pyodbc
thank you all for the answers. 谢谢大家的回答。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.