权限错误:[Errno 13] python项目中的权限被拒绝

voj3qocg  于 2023-02-18  发布在  Python
关注(0)|答案(1)|浏览(275)

我正在开发一个需要安装airnotifier的应用程序,我已经按照以下链接中的安装说明进行了安装:
https://github.com/dcai/airnotifier/wiki/Installation-3.x
在运行www.example.com的最后一个命令时app.py,我收到以下错误

airnotifier@airnotifier:~/airnotifier$ pipenv run python app.py
app.py:73: DeprecationWarning: The 'warn' function is deprecated, use 'warning' instead
  logging.warn("Sentry dsn is not set")
[W 220718 20:08:43 app:73] Sentry dsn is not set
[I 220718 20:08:43 routes:73] init route: controllers.auth
[I 220718 20:08:43 routes:73] init route: controllers.base
[I 220718 20:08:43 routes:73] init route: controllers.broadcast
[I 220718 20:08:43 routes:73] init route: controllers.keys
[I 220718 20:08:43 routes:73] init route: controllers.newapp
[I 220718 20:08:43 routes:73] init route: controllers.settings
[I 220718 20:08:43 routes:73] init route: controllers.tokens
[I 220718 20:08:43 routes:73] init route: api.accesskeys
[I 220718 20:08:43 routes:73] init route: api.broadcast
[I 220718 20:08:43 routes:73] init route: api.push
[I 220718 20:08:43 routes:73] init route: api.tokens
Traceback (most recent call last):
  File "app.py", line 95, in <module>
    WebApplication(container).main()
  File "/home/airnotifier/airnotifier/web.py", line 146, in main
    http_server.listen(options.port)
  File "/home/airnotifier/.local/share/virtualenvs/airnotifier-dIcrTSca/lib/python3.8/site-packages/tornado/tcpserver.py", line 151, in listen
    sockets = bind_sockets(port, address=address)
  File "/home/airnotifier/.local/share/virtualenvs/airnotifier-dIcrTSca/lib/python3.8/site-packages/tornado/netutil.py", line 174, in bind_sockets
    sock.bind(sockaddr)
PermissionError: [Errno 13] Permission denied
airnotifier@airnotifier:~/airnotifier$

我检查了文件的权限并搜索了很多,但找不到解决此问题的方法

mrphzbgm

mrphzbgm1#

您需要使用sudo来运行,正如您所链接的安装说明中所述。正如您所看到的,错误来自于试图将套接字绑定到端口。最有可能的是,它试图使用特权端口(〈1024),这只能通过提升权限(即sudo)来完成。

相关问题