笔记
更新apt-get:
- sudo apt-get upgrade
- sudo apt-get update
安装C编译(必须):
部分服务器厂商没有, 阿里云腾讯云谷歌云亚马逊都预装了
- sudo apt-get install gcc;
- sudp apt-get install g++;
- sudo apt-get install make
安装python(部分新服务器没有)
- sudo apt-get install python2.7
- sudo apt-get install python3.5(目前遇到的服务器都有3.x版本)
- sudo apt-get install python-pip
- sudo apt-get install python3-pip
- pip install –upgrade pip
遇到的错误
如果遇到以下错误:
Traceback (most recent call last): File "/usr/bin/pip", line 9, in <module> from pip import main ImportError: cannot import name main
将上面代码换成:
from pip import __main__ if __name__ == '__main__': sys.exit(__main__._main())
在pip 安装MySQL-python 会遇到以下错误
Traceback (most recent call last): File "<string>", line 1, in <module> File "/tmp/pip-install-qI3fAK/MySQL-python/setup.py", line 17, in <module> metadata, options = get_config() File "setup_posix.py", line 43, in get_config libs = mysql_config("libs_r") File "setup_posix.py", line 25, in mysql_config raise EnvironmentError("%s not found" % (mysql_config.path,)) EnvironmentError: mysql_config not found
只需要提前安装下:
sudo apt-get install libmysqlclient-dev
遇到下面问题:
Warning: (1287L, u"'@@tx_isolation' is deprecated and will be removed in a future release. Please use'@@transaction_isolation' instead") cursor.execute('SELECT @@tx_isolation')
gunicorn问题:
查看gunicorn进程 pstree -ap|grep gunicorn 重启gunicorn kill -HUP 30080(进程ID)
如果没有pstree命令
sudo apt-get install psmisc