简体   繁体   English

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

[英]PermissionError: [Errno 13] Permission denied in python project

I am working on an application that needs installation for airnotifier, I have followed the installation instruction in the following link:我正在开发一个需要安装 airnotifier 的应用程序,我已按照以下链接中的安装说明进行操作:

https://github.com/dcai/airnotifier/wiki/Installation-3.x https://github.com/dcai/airnotifier/wiki/Installation-3.x

on the last command of running app.py I got the following error在运行 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$

I checked the permissions of the files and searched a lot but couldn't find a way to solve this problem我检查了文件的权限并搜索了很多但找不到解决此问题的方法

You need to run with sudo , as stated in the installation instructions you linked.您需要使用sudo运行,如您链接的安装说明中所述。 As you see, the error comes from trying to bind a socket to a port.如您所见,错误来自尝试将套接字绑定到端口。 Most probably it's trying to use a privileged port (<1024), which can only be done with elevated permissions (ie sudo ).很可能它正在尝试使用特权端口(<1024),这只能通过提升的权限(即sudo )来完成。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM