sudo easy_install pip
pip install mezzanine
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install postgresql -v
initdb /usr/local/var/postgres -E utf8
设成开机启动 PostgreSQL:ln -sfv /usr/local/opt/postgresql/*.plist ~/Library/LaunchAgents
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
pg_ctl -D /usr/local/var/postgres stop -s -m fast
五、装psycopg2sudo pip install psycopg2
>>> import django
>>> django.VERSION
(1, 9, 1, 'final', 0)
>>> import psycopg2
>>> psycopg2
<module 'psycopg2' from '/Library/Python/2.7/site-packages/psycopg2/__init__.pyc'>
>>>
本文介绍了如何在Mac OS操作系统中创建Django开发环境,包括使用easy_install安装pip,通过pip安装Mezzanine,利用Homebrew安装PostgreSQL,初始化数据库,并设置环境变量。此外,还展示了启动和停止PostgreSQL服务的命令,以及验证Django和psycopg2(PostgreSQL的Python适配器)安装成功的步骤。
469

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



