- ubuntu下python2.7 安装spp 模块(pip install spp)报错:
Traceback (most recent call last): File “/usr/bin/pip”, line 9, in
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 166, in
main
text = ‘\n’.join(complete_log) UnicodeDecodeError: ‘ascii’ codec can’t decode byte 0xe6 in position 51: ordinal not in range(128)
估计是字符编码解码过程中导致的问题。
解决的办法:
在/usr/lib/python2.7/sitecustomize.py脚本中加上如下三行即可:
import sys
reload(sys)
sys.setdefaultencoding(‘utf-8’)
- 加入上述语句后,重新安装,发现又报错:
src/spp.c:4:20: fatal error: Python.h: 没有那个文件或目录 compilation
terminated. error: command ‘x86_64-linux-gnu-gcc’ failed with exit
status 1
其实这个错误是一个间接,由其依赖引起。
解决的办法:
安装python-dev,这是Python的头文件和静态库包:
sudo apt-get install python-dev
- 安装pip install captchaimage时候,又报如下错误:
captchaimage.c:12:22: fatal error: ft2build.h: 没有那个文件或目录 compilation
terminated. error: command ‘x86_64-linux-gnu-gcc’ failed with exit
status 1
解决的办法:
这是由于显示文字信息时还需要与字体相关的东西,解决方案:
sudo apt-get install libfreetype6-dev
- 安装pycurl-7.43.0报错:
File “setup.py”, line 107, in configure_unix
raise ConfigurationError(msg)
main.ConfigurationError: Could not run curl-config: [Errno 2] No such file or directory
解决方案:
sudo apt-get install libcurl4-openssl-dev
参考资料:
http://blog.csdn.net/edward_liang_/article/details/50440045
http://blog.sina.com.cn/s/blog_6c39196501013s5b.html
http://blog.csdn.net/u012226330/article/details/17611749
在Ubuntu环境下使用python2.7安装spp模块时遇到'ascii' codec不能解码的UnicodeDecodeError,通过在sitecustomize.py中设置编码为utf-8暂时解决。但接着在安装过程中出现Python.h缺失和ft2build.h文件找不到的编译错误,分别需要安装python-dev和字体相关库来解决。最后,安装pycurl时的curl-config问题,需要查阅相关资料找到解决方案。

2773

被折叠的 条评论
为什么被折叠?



