我从这个地址下载了web.py: http://webpy.org/static/web.py-0.37.tar.gz 然后提取并将文件复制到我的电脑中的python地址并运行setup.py。但是当我在python(2.7)中编写“import web”时,我收到此错误“没有名为web的模块”。如何正确安装web.py? 我为我糟糕的英语道歉。
答案 0 :(得分:0)
easy_install web.py
或
pip install web.py
或从目录下载* .tar.gz,解包和运行命令:
python.exe setup.py install
答案 1 :(得分:0)
每当你在Python中找不到一个模块时,你应该首先检查Python搜索模块的路径,即
>>> import sys
>>> print "\n".join(sys.path)
/usr/bin
/usr/local/lib/python2.7/dist-packages/web.py-0.37-py2.7.egg
/usr/lib/python2.7
/usr/lib/python2.7/plat-linux2
/usr/lib/python2.7/lib-tk
/usr/lib/python2.7/lib-old
/usr/lib/python2.7/lib-dynload
/usr/local/lib/python2.7/dist-packages
/usr/lib/python2.7/dist-packages
/usr/lib/python2.7/dist-packages/PIL
/usr/lib/python2.7/dist-packages/gst-0.10
/usr/lib/python2.7/dist-packages/gtk-2.0
/usr/lib/pymodules/python2.7
/usr/lib/python2.7/dist-packages/ubuntu-sso-client
/usr/lib/python2.7/dist-packages/ubuntuone-client
/usr/lib/python2.7/dist-packages/ubuntuone-control-panel
/usr/lib/python2.7/dist-packages/ubuntuone-couch
/usr/lib/python2.7/dist-packages/ubuntuone-installer
/usr/lib/python2.7/dist-packages/ubuntuone-storage-protocol