zoukankan      html  css  js  c++  java
  • Windows部署pyspider指南

    1.安装python 2.7

      下载地址:https://www.python.org/downloads/,记得要勾选最后的添加环境变量。

    2.安装pyspider

      打开命令提示符=》输入pip install pyspider

    3.新建文件夹(个人需求)

      在C:Python27Libsite-packages下新建文件夹pyspider_helper用于存放辅助py文件

    4.安装Microsoft Visual C++ Compiler for Pyhon 2.7

      下载地址:http://www.microsoft.com/en-us/download/confirmation.aspx?id=44266

    5.安装第三方库出现 Python version 2.7 required, which was not found in the registry解决办法

    import sys  
        
    from _winreg import *  
        
    # tweak as necessary  
    version = sys.version[:3]  
    installpath = sys.prefix  
        
    regpath = "SOFTWARE\Python\Pythoncore\%s\" % (version)  
    installkey = "InstallPath"  
    pythonkey = "PythonPath"  
    pythonpath = "%s;%s\Lib\;%s\DLLs\" % (  
        installpath, installpath, installpath  
    )  
        
    def RegisterPy():  
        try:  
            reg = OpenKey(HKEY_CURRENT_USER, regpath)  
        except EnvironmentError as e:  
            try:  
                reg = CreateKey(HKEY_CURRENT_USER, regpath)  
                SetValue(reg, installkey, REG_SZ, installpath)  
                SetValue(reg, pythonkey, REG_SZ, pythonpath)  
                CloseKey(reg)  
            except:  
                print "*** Unable to register!"  
                return  
            print "--- Python", version, "is now registered!"  
            return  
        if (QueryValue(reg, installkey) == installpath and  
            QueryValue(reg, pythonkey) == pythonpath):  
            CloseKey(reg)  
            print "=== Python", version, "is already registered!"  
            return  
        CloseKey(reg)  
        print "*** Unable to register!"  
        print "*** You probably have another Python installation!"  
          
    if __name__ == "__main__":  
        RegisterPy()

      运行此段代码。

    6.安装MySQL驱动

      下载驱动: 
      64位:MySQL-python-1.2.3.win-amd64-py2.7.exe 
      32位: MySQL-python-1.2.5.win32-py2.7.exe

      我的服务器上装的上方32位的,装64会报版本错误,很奇怪。

    7.安装MySQLdb

      命令提示符下输入:pip install mysql

    8.安装mysql-connector

      下载地址 https://dev.mysql.com/downloads/file/?id=472568

    9.安装阿里云对象存储

      文档地址:https://help.aliyun.com/document_detail/32026.html?spm=a2c4g.11174283.6.690.fJtbIT

      命令提示符输入:pip install oss2

    10.其他依赖的库

      PIL:pip install Pillow 

    11.connect to scheduler rpc error:Error 10061...

      这是部署过程遇到的一个最大的问题,我遇到的情况导致原因是Tornado5.0版本不支持,将其卸载并安装4.5版本问题解决

      pip uninstall tornado

      pip install tornado==4.5.0

      详情:https://github.com/binux/pyspider/issues/771

  • 相关阅读:
    staticmethod & classmethod
    stanford Python
    LD_LIBRARY_PATH
    Centos7.2 errors
    theano profile
    电梯开关量GPIO配置记录
    定时器配置 中断配置 GPIO
    电梯开发进度贴
    Makefile编写学习摘要
    数据挖掘聚类算法--Kmeans
  • 原文地址:https://www.cnblogs.com/zran/p/8805808.html
Copyright © 2011-2022 走看看