最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

python 3.x - Uvicorn dependency issue - Stack Overflow

programmeradmin4浏览0评论

I want to create a Django webserver capable of handling HTTP requests and WebSocket requests. I am using uvicorn so that both types of requests can be handled in the same server instance. Whenever I try to launch my server with the command:

uvicorn core.asgi:application --host 0.0.0.0 --port 8000

I get the error message:

python3.11/site-packages/uvicorn/protocols/websockets/websockets_impl.py", line 11, in <module>
import websockets.legacy.handshake 
ModuleNotFoundError: No module named 'websockets.legacy'

Here is my conda file:

name: [env-name]
channels:
  - conda-fe
  - defaults
dependencies:
  - channels
  - python=3.11
  - daphne
  - django
  - djangorestframework
  - uvicorn
  - boto3
  - pip
  - pip:
    - django-cors-headers
    - websockets
    - "uvicorn[standard]"

I'm not sure why this is happening.

I've tried pip installing all of the dependencies, reinstalling the virtual environment, but it always says "Requirement Already Satisfied".

发布评论

评论列表(0)

  1. 暂无评论