python3安装web.py
今天准备测试代理池IPProxyPool获取到ip的质量,在安装web.py的时候遇到了些问题,在此记录一下。
1.安装资料
web.py官网:http://webpy.org/
web.py的github地址:https://github.com/webpy/webpy/
2.安装
方法1:(推荐)
pip install web.py==0.40-dev1
方法2:
注意:这个是使用linux软连接方式
git clone git://github.com/webpy/webpy.git
ln -s `pwd`/webpy/web .
方法3(从源码处安装):
git clone https://github.com/webpy/webpy.git
cd webpy
python setup.py install
pip list
3.问题
3.1.python2与python3问题
pip install web.py
上面安装命令只支持python2,官网上已经说明过。这样安装会报错:
ERROR: Command errored out with exit status :
command: 'e:\program\python\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\peng\\AppData\\Local\\Temp\\pip-install-ubdky_a3\\web.py\\setup.py'"'"'; __file__='"'"'C:\\Users\\peng\\AppData\\Local\\Temp\\pip-install-ubdky_a3\\web.py\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base pip-egg-info
cwd: C:\Users\peng\AppData\Local\Temp\pip-install-ubdky_a3\web.py\
Complete output ( lines):
Traceback (most recent call last):
File "<string>", line , in <module>
File "C:\Users\peng\AppData\Local\Temp\pip-install-ubdky_a3\web.py\setup.py", line , in <module>
from web import __version__
File "C:\Users\peng\AppData\Local\Temp\pip-install-ubdky_a3\web.py\web\__init__.py", line , in <module>
import utils, db, net, wsgi, http, webapi, httpserver, debugerror
ModuleNotFoundError: No module named 'utils'
----------------------------------------
ERROR: Command errored out with exit status : python setup.py egg_info Check the logs for full command output.
主要是这个错误:
Traceback (most recent call last):
File "<string>", line , in <module>
File "C:\Users\peng\AppData\Local\Temp\pip-install-ubdky_a3\web.py\setup.py", line , in <module>
from web import __version__
File "C:\Users\peng\AppData\Local\Temp\pip-install-ubdky_a3\web.py\web\__init__.py", line , in <module>
import utils, db, net, wsgi, http, webapi, httpserver, debugerror
ModuleNotFoundError: No module named 'utils'
原因是,除了0.40-dev1版本支持python3外其他版本都不支持(测试过webpy-0.39)
github上的版本:https://github.com/webpy/webpy/tags
3.2.测试hello world出错
官网例子:
import web urls = (
'/(.*)', 'hello'
)
app = web.application(urls, globals()) class hello:
def GET(self, name):
if not name:
name = 'World'
return 'Hello, ' + name + '!' if __name__ == "__main__":
app.run()
错误:
Traceback (most recent call last):
File "E:\Program\python\lib\site-packages\web\utils.py", line , in take
yield next(seq)
StopIteration The above exception was the direct cause of the following exception: Traceback (most recent call last):
File ".\test_web.py", line , in <module>
app = web.application(urls, globals())
File "E:\Program\python\lib\site-packages\web\application.py", line , in __init__
self.init_mapping(mapping)
File "E:\Program\python\lib\site-packages\web\application.py", line , in init_mapping
self.mapping = list(utils.group(mapping, ))
File "E:\Program\python\lib\site-packages\web\utils.py", line , in group
x = list(take(seq, size))
RuntimeError: generator raised StopIteration
解决方法:
修改Lib\site-packages\web 下的utils.py文件,在526行
源码:
def take(seq, n):
for i in range(n):
yield next(seq)
修改后:
def take(seq, n):
for i in range(n):
try:
yield next(seq)
except StopIteration:
return
运行:


python3安装web.py的更多相关文章
- Windows下安装Web.py快速指南
环境介绍 首先介绍下安装使用的环境 - Windows 7 - Python 3.6 Web.py介绍 web.py是Python在Web领域一个轻量级的解决方案,所谓轻量,就是非常简单快速满足Web ...
- 使用PuTTy在CentOS下安装web.py与简单的文件传输
两周前,出于帮朋友忙的目的,尝试了一下微信公众号的菜单自定义与自动回复功能的实现,成了. 两周后,需要将代码转移至朋友新购的服务器上,发现基本操作全忘记了,麻瓜!所以记一笔,希望也能对大家也有帮助. ...
- python3.X 安装web.py 失败的解决方法
python2.x 安装python是非常顺利的 但是 在进行 pip3 install web.py 时提示很多错误 例如缺少模块 语法错误...... 最后试了一下web.py 的dev版本 pi ...
- python3使用web.py遇到的找不属性的错误解决
今天用pyhon安装完web.py的时候,点击运行还是没错的,但是在网页输入链接就会报错.1.安装我是这样的: pip install web.py 2.运行后错误信息是这样: AttributeEr ...
- CentOS7+Python3.6利用web.py库进行微信公众平台服务器简易配置,token验证
1.安装配置Python CentOS7 自带 Python2.7, 我用的是Python3.6.5,需要CentOS7安装配置Python3并和Python2共存的,请看以下教程: CentOS7安 ...
- python web.py安装使用
官方首页:http://webpy.org/) 它的源代码非常整洁精干,学习它一方面可以让我们快速了解python语法(遇到看不懂的语法就去google),另一方面可以学习到python高级特性的使用 ...
- web.py 安装
安装 安装web.py, 请先下载: http://webpy.org/static/web.py-0.37.tar.gz 或者获取最新的开发版: https://github.com/webpy/w ...
- windows下如何快速搭建web.py开发框架
在windows下如何快速搭建web.py开发框架 用Python进行web开发的话有很多框架供选择,比如最出名的Django,tornado等,除了这些框架之外,有一个轻量级的框架使用起来也是非常方 ...
- 在windows下如何快速搭建web.py开发框架
在windows下如何快速搭建web.py开发框架 用Python进行web开发的话有很多框架供选择,比如最出名的Django,tornado等,除了这些框架之外,有一个轻量级的框架使用起来也是非常方 ...
随机推荐
- C#基础--go to
goto语句的用法非常灵活,你可以用它实现很多功能,但是由于goto语句的跳转影响程序的结构,在使用的时候会使人迷茫,所以一般"教材"上都不建议使用,但是用它可以实现递归,循环,选 ...
- sql过程的条件是IN,用脚本执行
DECLARE @sql nvarchar(); DECLARE @inStr nvarchar(); SET @inStr='''条件1'',''条件2'''; set @sql='SELECT * ...
- SSRF(服务端请求伪造)
- export default和export的使用方式
在node中使用 var 名称=require('模块标识符') 来导入 module.exports 和exports 来暴露成员 在ES6中,也通过规范的形式,规定了ES6中如何导入和导出模块 E ...
- AngularJS入门教程之与服务器(Ajax)交互操作示例
AngularJS从Web服务器请求资源都是通过Ajax来完成,所有的操作封装在$http服务中,$http服务是只能接收一个参数的函数,这个参数是一个对象,用来完成HTTP请求的一些配置,函数返回一 ...
- SpringDataJPA第二天讲义
第1章 Spring Data JPA的概述 1.1 Spring Data JPA概述 Spring Data JPA 是 Spring 基于 ORM 框架.JPA 规范的基础上封装的 ...
- You're currently running Fcitx with GUI 错误解决 Fcitx
在英文版ubuntu配置输入法时,点击 Configure Current Input Method 会报以下的错误: You’re currently running Fcitx with GUI, ...
- Linux路径切换命令——directory stack
操作directory stack一共需要3个命令: dirs .pushd.popd dirs: 显示当前目录栈 pushd: 把目录压栈 popd: 把目录弹栈 dirs 显示目录栈内容,如果没有 ...
- hibernate使用注解生成表,有时无法生成数据表的原因
待生成表中有字段“desc”或“descripe”等和hibernate关键字,导致和hibernate冲突
- tensorflow实战笔记(20)----textRNN
https://www.cnblogs.com/jiangxinyang/p/10208227.html https://www.cnblogs.com/jiangxinyang/p/10241243 ...