无法从virtualenv内部运行达芙妮

时间:2018-10-03 11:19:59

标签: python django-channels daphne

我正在尝试运行安装在virtualenv内的daphne,以下是错误:

  Traceback (most recent call last):
  File "/path-to-virtualenv/bin/daphne", line 7, in <module>
    from daphne.cli import CommandLineInterface
  File "/path-to-virtualenv/local/lib/python3.6/dist-packages/daphne/cli.py", line 7, in <module>
    from .server import Server
  File "/path-to-virtualenv/local/lib/python3.6/dist-packages/daphne/server.py", line 4, in <module>
    from twisted.internet import asyncioreactor  # isort:skip
  ModuleNotFoundError: No module named 'twisted.internet'

环境:
 1. mac osx mojave
 2. python 3.6.5

  

当我激活virtualenv后尝试导入模块 twisted.internet 时,它可以正常工作。

当我尝试在不使用virtualenv(全局安装)的情况下运行daphne时,它可以正常运行而不会抛出如图所示的任何错误。

以下是安装的软件包(通过pip install -U通道):

asgiref       2.3.2  
async-timeout 3.0.0  
attrs         18.2.0 
autobahn      18.9.2 
Automat       0.7.0  
channels      2.1.3  
constantly    15.1.0 
daphne        2.2.2  
Django        2.1.2  
hyperlink     18.0.0 
idna          2.7    
incremental   17.5.0 
pip           18.0   
PyHamcrest    1.9.0  
pytz          2018.5 
setuptools    40.4.3 
six           1.11.0 
txaio         18.8.1 
wheel         0.32.0

0 个答案:

没有答案