1、问题:服务代码需要python2.6运行,安装的扩展需要python2.7以上
解决:指定版本安装
pip install SQLAlchemy==1.0.9 -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
import sqlalchemy print sqlalchemy.__version__
常用pip源:
阿里云 http://mirrors.aliyun.com/pypi/simple/ 豆瓣(douban) http://pypi.douban.com/simple/ 清华大学 https://pypi.tuna.tsinghua.edu.cn/simple/ 中国科学技术大学 http://pypi.mirrors.ustc.edu.cn/simple/
2、Tornado 错误 “Global name ‘memoryview’ is not defined”
解决:
pip uninstall tornado pip install tornado==2.1.1
3、mac python2.7安装pip报错:
Installing collected packages: pip WARNING: The scripts pip, pip2 and pip2.7 are installed in '/Users/yongmenggan/Library/Python/2.7/bin' which is not on PATH. Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
解决:
echo 'export PATH=/Users/yongmenggan/Library/Python/2.7/bin:$PATH' >>~/.bashrc source ~/.bashrc
4、pip安装zeroc-ice报错:
src/ice/cpp/src/Ice/ConnectionI.cpp:27:21: 致命错误:.....
解决:
原因是缺失相关依赖包 mcpp、bzip2、expat等
安装相关依赖包:
yum install lmdb-devel mcpp-devel yum install bzip2-devel yum install expat-devel
如果提示没有相关包,可以执行以下命令:
yum -y install epel-release yum update
转载请注明:永盟博客 » python问题解决汇总