ipython出现"pkg_resources.DistributionNotFound:ipython==4.0.0"

搭建完virtualenv环境下安装ipython报如下异常:

1
2
3
4
5
6
7
8
9
10
11
(xblog) [root@cdnopsv01 /opt/git/www/xblog]# ipython
Traceback (most recent call last):
File "/usr/bin/ipython", line 5, in <module>
from pkg_resources import load_entry_point
File "/usr/local/lib/python2.7/site-packages/distribute-0.6.10-py2.7.egg/pkg_resources.py", line 2655, in <module>
working_set.require(__requires__)
File "/usr/local/lib/python2.7/site-packages/distribute-0.6.10-py2.7.egg/pkg_resources.py", line 648, in require
needed = self.resolve(parse_requirements(requirements))
File "/usr/local/lib/python2.7/site-packages/distribute-0.6.10-py2.7.egg/pkg_resources.py", line 546, in resolve
raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: ipython==4.0.0

django环境初始化与配置总结

一、创建python虚拟环境

安装virtualenv(创建独立python环境)
easy_install --index-url=http://pypi.douban.com/simple virtualenv virtualenvwrapper
安装virtualenvwrapper(提供virtualenv便利管理命令)
linux环境配置:
easy_install --index-url=http://pypi.douban.com/simple virtualenvwrapper

~/.bash_profile 文件增加如下几行
export WORKON_HOME=/opt/.virtualenvs
export PROJECT_HOME=/opt/workspace
source /usr/bin/virtualenvwrapper.sh

windows环境配置:
easy_install --index-url=http://pypi.douban.com/simple virtualwrapper-win

django创建表异常"Specified key was too long; max key length is 1000 bytes"

最近在温习django知识,学习开发一个简单的博客系统玩玩,初始化mysql数据表的时候失败,如下所示:

python manage.py  migrate
1
2
3
File "/opt/.virtualenvs/dj1.9/lib/python2.7/site-packages/MySQL_python-1.2.5-py2.7-linux-x86_64.egg/MySQLdb/cursors.py", line 205, in execute
File "/opt/.virtualenvs/dj1.9/lib/python2.7/site-packages/MySQL_python-1.2.5-py2.7-linux-x86_64.egg/MySQLdb/connections.py", line 36, in defaulterrorhandler
django.db.utils.OperationalError: (1071, 'Specified key was too long; max key length is 1000 bytes')
,