So I'm getting the following error when running a script that imports web
.
$ python bin/app.py
Traceback (most recent call last):
File "bin/app.py", line 1, in <module>
import web
ImportError: No module named web
I tried using easy_install web
but get this error:
$ easy_install web
Searching for web
Reading http://pypi.python.org/simple/web/
Reading http://www.pythonweb.org/web/
Reading http://www.pythonweb.org/web/release/
No local packages or download links found for web
error: Could not find suitable distribution for Requirement.parse('web')
And I tried pip install web
but get the following:
$ pip install web
Downloading/unpacking web
Could not find any downloads that satisfy the requirement web
No distributions at all found for web
Storing complete log in /Users/zcj90/.pip/pip.log
Traceback (most recent call last):
File "/usr/local/bin/pip", line 8, in <module>
load_entry_point('pip==1.0.2', 'console_scripts', 'pip')()
File "/Library/Python/2.6/site-packages/pip-1.0.2-py2.6.egg/pip/__init__.py", line 116, in main
return command.main(initial_args, args[1:], options)
File "/Library/Python/2.6/site-packages/pip-1.0.2-py2.6.egg/pip/basecommand.py", line 151, in main
log_fp = open_logfile(log_fn, 'w')
File "/Library/Python/2.6/site-packages/pip-1.0.2-py2.6.egg/pip/basecommand.py", line 180, in open_logfile
log_fp = open(filename, mode)
IOError: [Errno 13] Permission denied: '/Users/zcj90/.pip/pip.log'
Any suggestions?
Code for app.py:
import web
urls = (
'/', 'index'
)
app = web.application(urls, globals())
class index:
def GET(self):
greeting = "Hello World"
return greeting
if __name__ == "__main__":
app.run()*
Pythonweb is pretty out of date, but they still have a downloads page where you can get the most recent release. Then just do a
python setup.py install
Old question, but for people who reach this via web search, this is the command you're looking for, assuming an apt-based linux distribution like ubuntu or debian:
$ sudo aptitude install python-webpy
You have to download source from http://webpy.org/static/web.py-0.36.tar.gz.
The steps to install web is on http://webpy.org/install.
Please follow the steps if got any error then add comments to this post or update the question.
For Ubuntu OS, install python web using below command:
The problem is that you most likely used
pip install lpthw.web
to install however the lpthw book is using python 2.7 so pip2.7 would fix this:pip2.7 install lpthw.web
The following is the command that you need to run
$ easy_install web.py
And according to the document for lpthw (which just uses a fork of web.py), you can run :
$ pip install lpthw.web
Then to run the application you will just need to do:
$ python app.py