【问题标题】:Python Bottle installationPython 瓶安装
【发布时间】:2023-04-06 05:38:01
【问题描述】:

我是 Python 新手。我下载了“bottle.py”并将其放在我的项目目录中。我创建了一个简单的 "helloworld.py" 。 Helloworld.py 是

from bottle import route, run

@route('/hello')

def hello():
    return "Hello World!"

run(host='localhost', port=8080, debug=True)

当我运行这个文件时,会弹出错误:

Traceback (most recent call last):
  File "C:/Users/kattula/PycharmProjects/Sample Codes/helloworld.py", line 6, in <module>
    run(host='localhost', port=8080, debug=True)
  File "C:\Users\kattula\PycharmProjects\Sample Codes\bottle.py", line 3112, in run
    server.run(app)
  File "C:\Users\kattula\PycharmProjects\Sample Codes\bottle.py", line 2766, in run
    srv = make_server(self.host, self.port, app, server_cls, handler_cls)
  File "C:\Python27\lib\wsgiref\simple_server.py", line 144, in make_server
    server = server_class((host, port), handler_class)
  File "C:\Python27\lib\SocketServer.py", line 408, in __init__
    self.server_bind()
  File "C:\Python27\lib\wsgiref\simple_server.py", line 48, in server_bind
    HTTPServer.server_bind(self)
  File "C:\Python27\lib\BaseHTTPServer.py", line 108, in server_bind
    SocketServer.TCPServer.server_bind(self)
  File "C:\Python27\lib\SocketServer.py", line 419, in server_bind
    self.socket.bind(self.server_address)
  File "C:\Python27\lib\socket.py", line 224, in meth
    return getattr(self._sock,name)(*args)
  socket.error: [Errno 10013] An attempt was made to access a socket in a way forbidden by its access permissions

Process finished with exit code 1

什么是错误。帮助 !。提前致谢。 `

【问题讨论】:

  • 您运行的是什么版本的 Windows?你是那台机器上的本地管理员吗?这在我看来是一个安全问题,因为您正尝试在端口 8080 上启动服务器。

标签:
python
python-2.7