最近在学习python,记点坑,免得以后又踩~
哦,对了,我用的mac,所以这里只做mac坑的记录,windows的可以参考。
Python安装pip:
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
sudo python get-pip.py
pygame安装:
《Python 编程:从入门到实践》里的命令是:pip install --user hg+http://bitbucket.org/pygame/pygame,但是结果
Error [Errno 2] No such file or directory while executing command hg clone --noupdate -q http://bitbucket.org/pygame/pygame /private/var/folders/ps/gdp6k5qs7wzg5fq_3m7nf7l80000gn/T/pip-req-build-2A9IG3
Cannot find command 'hg' - do you have 'hg' installed and in your PATH?
无奈再试:pip install pygame,提示没有权限,
Could not install packages due to an EnvironmentError: [Errno 1] Operation not permitted: '/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/pygame'
OK,再加sudo试一波,sudo pip install pygame 以后,还是报错
Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/pygame-1.9.5.dist-info'
Consider using the `--user` option or check the permissions.
但是这回报错不会那么离谱,仔细看下,操作被拒绝了,那么,再试
sudo pip install pygame --user
OK,安装成功。
matplotlib安装:
sudo pip install --user matplotlib
virtualenv安装:
sudo pip install --user virtualenv
Django安装:
Sublime Text:
新建一个New Build System
将
"cmd": ["/usr/local/bin/python3", "-u", "$file"],
替换掉"shell_cmd": "make",其中“/usr/local/bin/python3”为路径,可在终端使用命令“type -a python3”查看。将文件命名为“Python3.sublime-build”,保存在默认路径下。最后更改编译环境:
如此,关闭之后,再open一个正确的py文件,即可。