python +如何安装模块web.py

时间:2015-08-11 07:15:13

标签: python python-3.x windows-xp

我在我的XP机器上安装了python版本 - 3.4.0

现在我想安装web.py模块 打印“var”,var

时安装失败

我猜是因为缺少“(”,“)”

但如何解决?

C:\Python34\Scripts>pip install web.py
 Downloading/unpacking web.py
 Running setup.py     (path:D:\DOCUME~1\uba\LOCALS~1\Temp\pip_build_uba\web.p
y\setup.py) egg_info for package web.py
   Traceback (most recent call last):
     File "<string>", line 17, in <module>
    File   "D:\DOCUME~1\ubarih\LOCALS~1\Temp\pip_build_uba\web.py\setup.py",
  line 6, in <module>
        from web import __version__
     File        "D:\DOCUME~1\uba\LOCALS~1\Temp\pip_build_uba\web.py\web\__init_
   _.py", line 14, in <module>
      import utils, db, net, wsgi, http, webapi, httpserver, debugerror
      File "C:\Python34\lib\site-packages\db\__init__.py", line 69
          print "var", var
                 ^
     SyntaxError: invalid syntax
     Complete output from command python setup.py egg_info:
       Traceback (most recent call last):

       File "<string>", line 17, in <module>

     File       "D:\DOCUME~1\uba\LOCALS~1\Temp\pip_build_uba\web.py\setup.py",    line
  6, in <module>

   from web import __version__

 File     "D:\DOCUME~1\ubarih\LOCALS~1\Temp\pip_build_uba\web.py\web\__init__.py
", line 14, in <module>

     import utils, db, net, wsgi, http, webapi, httpserver, debugerror

   File "C:\Python34\lib\site-packages\db\__init__.py", line 69

   print "var", var

          ^

  SyntaxError: invalid syntax

----------------------------------------
 Cleaning up...

1 个答案:

答案 0 :(得分:3)

您在计算机上安装了Python 3.4,但web.py不支持Python3.X。

如果查看源代码,您会看到git中有branch,但迁移似乎不完整。 (https://github.com/webpy/webpy/tree/python3/web)。

还有关于迁移的讨论(https://groups.google.com/forum/#!topic/webpy/NvDqKEEEMEI)。

安装开发分支

您可以通过从github下载源来尝试此分支 (https://github.com/webpy/webpy/archive/python3.zip)。下载文件后,将其解压缩并运行setup-script

setup.py install 

从python命令提示符(假设您在Windows上)。

但无法保证此版本能按预期工作。

作为(更容易?)的替代方案:

如果您想使用web.py,请尝试安装python 2.7.xhttps://www.python.org/downloads/release/python-2710/),然后通过web.py安装pip