在Windows上的Python 3.5上安装Django-channels时出错

时间:2017-12-22 07:09:37

标签: python django django-rest-framework twisted django-channels

我在安装Twisted时也遇到了同样的错误。

这是版本信息:

  • Django:1.9
  • Python:3.5
  • 尝试安装最新版本的Django-channels
  • 使用的命令:pip install channels

错误:

  

运行build_ext
   建立'twisted.test.raiser'扩展错误:   [WinError 2]系统找不到指定的文件

(差不多)完整的错误消息

.......pip install channels
Collecting channels
  Using cached channels-1.1.8-py2.py3-none-any.whl
Collecting daphne~=1.3 (from channels)
  Using cached daphne-1.3.0-py2.py3-none-any.whl
Requirement already satisfied: asgiref~=1.1 in g:\django\projectChat\venv\lib\site-packages (from channels
)
Requirement already satisfied: Django>=1.8 in g:\django\projectChat\venv\lib\site-packages (from channels)

Requirement already satisfied: autobahn>=0.18 in g:\django\projectChat\venv\lib\site-packages (from daphne
~=1.3->channels)
Collecting twisted>=17.1 (from daphne~=1.3->channels)
  Using cached Twisted-17.9.0.tar.bz2
Requirement already satisfied: six in g:\django\projectChat\venv\lib\site-packages (from asgiref~=1.1->cha
nnels)
Requirement already satisfied: txaio>=2.7.0 in g:\django\projectChat\venv\lib\site-packages (from autobahn
>=0.18->daphne~=1.3->channels)
Requirement already satisfied: zope.interface>=4.0.2 in g:\django\projectChat\venv\lib\site-packages (from
 twisted>=17.1->daphne~=1.3->channels)
Requirement already satisfied: constantly>=15.1 in g:\django\projectChat\venv\lib\site-packages (from twis
ted>=17.1->daphne~=1.3->channels)
Requirement already satisfied: incremental>=16.10.1 in g:\django\projectChat\venv\lib\site-packages (from
twisted>=17.1->daphne~=1.3->channels)
Requirement already satisfied: Automat>=0.3.0 in g:\django\projectChat\venv\lib\site-packages (from twiste
d>=17.1->daphne~=1.3->channels)
Requirement already satisfied: hyperlink>=17.1.1 in g:\django\projectChat\venv\lib\site-packages (from twi
sted>=17.1->daphne~=1.3->channels)
Requirement already satisfied: setuptools in g:\django\projectChat\venv\lib\site-packages (from zope.inter
face>=4.0.2->twisted>=17.1->daphne~=1.3->channels)
Requirement already satisfied: attrs in g:\django\projectChat\venv\lib\site-packages (from Automat>=0.3.0-
>twisted>=17.1->daphne~=1.3->channels)
Installing collected packages: twisted, daphne, channels
  Running setup.py install for twisted ... error
    Complete output from command G:\django\projectChat\venv\Scripts\python.exe -u -c "import setuptools, t
okenize;__file__='C:\\Users\\Mike\\AppData\\Local\\Temp\\pip-build-ngnwgsvg\\twisted\\setup.py';f=getattr(tokenize, 'open'
, open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Use
rs\Mike\AppData\Local\Temp\pip-y5sbi03u-record\install-record.txt --single-version-externally-managed --compile --install-
headers G:\django\projectChat\venv\include\site\python3.5\twisted:
    running install
    running build
    running build_py
    creating build
    creating build\lib.win-amd64-3.5
    creating build\lib.win-amd64-3.5\twisted
    copying src\twisted\copyright.py -> build\lib.win-amd64-3.5\twisted
    copying src\twisted\plugin.py -> build\lib.win-amd64-3.5\twisted
    copying src\twisted\_version.py -> build\lib.win-amd64-3.5\twisted
    copying src\twisted\__init__.py -> build\lib.win-amd64-3.5\twisted
    copying src\twisted\__main__.py -> build\lib.win-amd64-3.5\twisted
    creating build\lib.win-amd64-3.5\twisted\application
    copying src\twisted\application\app.py -> build\lib.win-amd64-3.5\twisted\application
    copying src\twisted\application\internet.py -> build\lib.win-amd64-3.5\twisted\application
    copying src\twisted\application\reactors.py -> build\lib.win-amd64-3.5\twisted\application
    copying src\twisted\application\service.py -> build\lib.win-amd64-3.5\twisted\application
    copying src\twisted\application\strports.py -> build\lib.win-amd64-3.5\twisted\application
    copying src\twisted\application\__init__.py -> build\lib.win-amd64-3.5\twisted\application
    creating build\lib.win-amd64-3.5\twisted\conch
    copying src\twisted\conch\avatar.py -> build\lib.win-amd64-3.5\twisted\conch
    [...]
    creating build\lib.win-amd64-3.5\twisted\_threads\test
    copying src\twisted\_threads\test\test_convenience.py -> build\lib.win-amd64-3.5\twisted\_threads\test
    copying src\twisted\_threads\test\test_memory.py -> build\lib.win-amd64-3.5\twisted\_threads\test
    copying src\twisted\_threads\test\test_team.py -> build\lib.win-amd64-3.5\twisted\_threads\test
    copying src\twisted\_threads\test\test_threadworker.py -> build\lib.win-amd64-3.5\twisted\_threads\test
    copying src\twisted\_threads\test\__init__.py -> build\lib.win-amd64-3.5\twisted\_threads\test
    running egg_info
    writing dependency_links to src\Twisted.egg-info\dependency_links.txt
    writing entry points to src\Twisted.egg-info\entry_points.txt
    writing src\Twisted.egg-info\PKG-INFO
    writing top-level names to src\Twisted.egg-info\top_level.txt
    writing requirements to src\Twisted.egg-info\requires.txt
    reading manifest file 'src\Twisted.egg-info\SOURCES.txt'
    reading manifest template 'MANIFEST.in'
    warning: no previously-included files matching '*.misc' found under directory 'src\twisted'
    warning: no previously-included files matching '*.bugfix' found under directory 'src\twisted'
    warning: no previously-included files matching '*.doc' found under directory 'src\twisted'
    warning: no previously-included files matching '*.feature' found under directory 'src\twisted'
    warning: no previously-included files matching '*.removal' found under directory 'src\twisted'
    warning: no previously-included files matching 'NEWS' found under directory 'src\twisted'
    warning: no previously-included files matching 'README' found under directory 'src\twisted'
    warning: no previously-included files matching 'newsfragments' found under directory 'src\twisted'
    warning: no previously-included files found matching 'src\twisted\topfiles\CREDITS'
    warning: no previously-included files found matching 'src\twisted\topfiles\ChangeLog.Old'
    warning: no previously-included files found matching 'pyproject.toml'
    warning: no previously-included files found matching 'codecov.yml'
    warning: no previously-included files found matching 'appveyor.yml'
    no previously-included directories found matching 'bin'
    no previously-included directories found matching 'admin'
    no previously-included directories found matching '.travis'
    warning: no previously-included files found matching 'docs\historic\2003'
    warning: no previously-included files matching '*' found under directory 'docs\historic\2003'
    writing manifest file 'src\Twisted.egg-info\SOURCES.txt'
    copying src\twisted\python\_sendmsg.c -> build\lib.win-amd64-3.5\twisted\python
    copying src\twisted\python\twisted-completion.zsh -> build\lib.win-amd64-3.5\twisted\python
    creating build\lib.win-amd64-3.5\twisted\python\_pydoctortemplates
    copying src\twisted\python\_pydoctortemplates\common.html -> build\lib.win-amd64-3.5\twisted\python\_pydoctortemplates
    copying src\twisted\python\_pydoctortemplates\index.html -> build\lib.win-amd64-3.5\twisted\python\_pydoctortemplates
    copying src\twisted\python\_pydoctortemplates\summary.html -> build\lib.win-amd64-3.5\twisted\python\_pydoctortemplates
    copying src\twisted\test\cert.pem.no_trailing_newline -> build\lib.win-amd64-3.5\twisted\test
    copying src\twisted\test\key.pem.no_trailing_newline -> build\lib.win-amd64-3.5\twisted\test
    copying src\twisted\test\raiser.c -> build\lib.win-amd64-3.5\twisted\test
    copying src\twisted\test\raiser.pyx -> build\lib.win-amd64-3.5\twisted\test
    copying src\twisted\test\server.pem -> build\lib.win-amd64-3.5\twisted\test
    copying src\twisted\internet\iocpreactor\build.bat -> build\lib.win-amd64-3.5\twisted\internet\iocpreactor
    copying src\twisted\internet\iocpreactor\notes.txt -> build\lib.win-amd64-3.5\twisted\internet\iocpreactor
    creating build\lib.win-amd64-3.5\twisted\internet\iocpreactor\iocpsupport
    copying src\twisted\internet\iocpreactor\iocpsupport\acceptex.pxi -> build\lib.win-amd64-3.5\twisted\internet\iocpreactor\
iocpsupport
    copying src\twisted\internet\iocpreactor\iocpsupport\connectex.pxi -> build\lib.win-amd64-3.5\twisted\internet\iocpreactor
\iocpsupport
    copying src\twisted\internet\iocpreactor\iocpsupport\iocpsupport.c -> build\lib.win-amd64-3.5\twisted\internet\iocpreactor
\iocpsupport
    copying src\twisted\internet\iocpreactor\iocpsupport\iocpsupport.pyx -> build\lib.win-amd64-3.5\twisted\internet\iocpreact
or\iocpsupport
    copying src\twisted\internet\iocpreactor\iocpsupport\winsock_pointers.c -> build\lib.win-amd64-3.5\twisted\internet\iocpre
actor\iocpsupport
    copying src\twisted\internet\iocpreactor\iocpsupport\winsock_pointers.h -> build\lib.win-amd64-3.5\twisted\internet\iocpre
actor\iocpsupport
    copying src\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi -> build\lib.win-amd64-3.5\twisted\internet\iocpreactor\i
ocpsupport
    copying src\twisted\internet\iocpreactor\iocpsupport\wsasend.pxi -> build\lib.win-amd64-3.5\twisted\internet\iocpreactor\i
ocpsupport
    copying src\twisted\internet\test\_awaittests.py.3only -> build\lib.win-amd64-3.5\twisted\internet\test
    copying src\twisted\internet\test\_yieldfromtests.py.3only -> build\lib.win-amd64-3.5\twisted\internet\test
    creating build\lib.win-amd64-3.5\twisted\internet\test\fake_CAs
    copying src\twisted\internet\test\fake_CAs\chain.pem -> build\lib.win-amd64-3.5\twisted\internet\test\fake_CAs
    copying src\twisted\internet\test\fake_CAs\not-a-certificate -> build\lib.win-amd64-3.5\twisted\internet\test\fake_CAs
    copying src\twisted\internet\test\fake_CAs\thing1.pem -> build\lib.win-amd64-3.5\twisted\internet\test\fake_CAs
    copying src\twisted\internet\test\fake_CAs\thing2-duplicate.pem -> build\lib.win-amd64-3.5\twisted\internet\test\fake_CAs
    copying src\twisted\internet\test\fake_CAs\thing2.pem -> build\lib.win-amd64-3.5\twisted\internet\test\fake_CAs
    copying src\twisted\mail\test\rfc822.message -> build\lib.win-amd64-3.5\twisted\mail\test
    copying src\twisted\python\test\_deprecatetests.py.3only -> build\lib.win-amd64-3.5\twisted\python\test
    copying src\twisted\words\im\instancemessenger.glade -> build\lib.win-amd64-3.5\twisted\words\im
    copying src\twisted\words\xish\xpathparser.g -> build\lib.win-amd64-3.5\twisted\words\xish
    running build_ext
    building 'twisted.test.raiser' extension
    error: [WinError 2] The system cannot find the file specified

    ----------------------------------------
Command "G:\django\projectChat\venv\Scripts\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Us
ers\\Mike\\AppData\\Local\\Temp\\pip-build-ngnwgsvg\\twisted\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f
.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\Mike\AppData\Loca
l\Temp\pip-y5sbi03u-record\install-record.txt --single-version-externally-managed --compile --install-headers G:\django\projectChat\venv\include\site\python3.5\twisted" failed with error code 1 in C:\Users\Mike\AppData\Local\Tem
p\pip-build-ngnwgsvg\twisted\

我不知道我错过了什么,请有人帮助我,谢谢。

4 个答案:

答案 0 :(得分:2)

您需要一个有效的C编译器来在没有提供轮子的平台上安装Twisted。 PyPI for Twisted上没有Python 3.5轮(目前)。所以你需要一个有效的C编译器。

按照these instructions for installing VS2015获取正常工作的C编译器,以便Twisted可以构建必要的扩展模块并成功安装。

答案 1 :(得分:2)

问题与是否需要Visual C ++ 14.0无关。它与Twisted的安装有关。经过数周的尝试,我得以解决此问题。 要安装正确版本的Twisted,请访问此link。 (在类似问题的答案上发现了这一点,我不确定作者是否应给予应有的荣誉)。 上述链接显示了Twisted的多个版本。您应该下载一个与您的python版本相对应的版本。例如,如果您的python版本是3.5,则应继续下载 cp35m-win32.whl (仅适用于Windows),依此类推。 此外,打开命令提示符,转到下载的路径以激活您的虚拟环境,然后pip安装下载的文件。 这将解决您的问题。

答案 2 :(得分:1)

我遇到了类似的问题...我只能通过下载Visual Studio Build工具并安装Visual C ++ Build Tools,Windows 10 SDK和VC ++ 2015.3 v14来解决此问题

enter image description here

答案 3 :(得分:0)

需要Microsoft Visual C ++。使用“ Microsoft Visual C ++生成工具”获取它:https://visualstudio.microsoft.com/downloads/