天天看點

新伺服器配置筆記

筆記

更新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
               

繼續閱讀