天天看点

新服务器配置笔记

笔记

更新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
遇到的错误
  1. 如果遇到以下错误:
    Traceback (most recent call last):
      File "/usr/bin/pip", line , in <module>
        from pip import main
    ImportError: cannot import name main
               
    将上面代码换成:
    from pip import __main__
    if __name__ == '__main__':
        sys.exit(__main__._main())
               
  2. 在pip 安装MySQL-python 会遇到以下错误
    Traceback (most recent call last):
          File "<string>", line , in <module>
          File "/tmp/pip-install-qI3fAK/MySQL-python/setup.py", line , in <module>
            metadata, options = get_config()
          File "setup_posix.py", line , in get_config
            libs = mysql_config("libs_r")
          File "setup_posix.py", line , in mysql_config
            raise EnvironmentError("%s not found" % (mysql_config.path,))
        EnvironmentError: mysql_config not found
    
               
    只需要提前安装下:
  3. 遇到下面问题:
    Warning: (, u"'@@tx_isolation' is deprecated 
    and will be removed in a future release. Please use'@@transaction_isolation' instead")
      cursor.execute('SELECT @@tx_isolation')
               
    新服务器配置笔记
    代码地址: https://github.com/zzzeek/sqlalchemy/pull/391/files
  4. gunicorn问题:
    查看gunicorn进程
        pstree -ap|grep gunicorn
        重启gunicorn
        kill -HUP (进程ID)
               
    如果没有pstree命令
    sudo apt-get install psmisc
               

继续阅读