简体   繁体   English

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

[英]Error while installing Django-channels on Python 3.5 on Windows

I'm also getting the same error while installing Twisted .我在安装Twisted也遇到同样的错误。

Here's version info:这是版本信息:

  • Django : 1.9姜戈:1.9
  • Python : 3.5蟒蛇:3.5
  • Trying to install latest version of Django-channels尝试安装最新版本的Django-channels
  • Command used : pip install channels使用的命令: pip install channels

The error :错误 :

running build_ext运行 build_ext
building 'twisted.test.raiser' extension error: [WinError 2] The system cannot find the file specified构建 'twisted.test.raiser' 扩展错误:[WinError 2] 系统找不到指定的文件

(Almost) full error message (几乎)完整的错误消息

.......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\

I don't know what i'm missing, could someone help me please, thanks.我不知道我错过了什么,有人可以帮助我,谢谢。

You need a working C compiler to install Twisted on platforms for which wheels are not provided.您需要一个可用的 C 编译器来在没有提供轮子的平台上安装 Twisted。 There is no Python 3.5 wheel on PyPI for Twisted (at this time). PyPI for Twisted 上没有 Python 3.5 轮子(此时)。 So you need a working C compiler.所以你需要一个可以工作的 C 编译器。

Follow these instructions for installing VS2015 to get a working C compiler so Twisted can build the necessary extension modules and install successfully.按照这些安装 VS2015 的说明获得一个可以工作的 C 编译器,以便 Twisted 可以构建必要的扩展模块并成功安装。

The problem is not regarding the need for Visual C++ 14.0 or whatsoever.问题不在于是否需要 Visual C++ 14.0 或其他任何东西。 It is concerned with the installation of Twisted.它与 Twisted 的安装有关。 I was able to fix this problem after trying for weeks together.一起尝试了数周后,我能够解决这个问题。 To install the correct version of Twisted visit this link .要安装正确版本的 Twisted,请访问此链接 (Found this on a similar question's answer, I'm not sure of the writer to give rightful credits). (在类似问题的答案中找到了这个,我不确定作者是否给予应有的荣誉)。 The above-mentioned link displays several versions of Twisted.上述链接显示了 Twisted 的多个版本。 You should download the one corresponding to your python version.您应该下载与您的python 版本相对应的那个。 For instance, if your python version is 3.5, you should proceed with downloading cp35m-win32.whl (For Windows only) and so forth.例如,如果您的 python 版本是 3.5,您应该继续下载cp35m-win32.whl (仅适用于 Windows)等等。 Further, open Command prompt, go to the downloaded path activate your virtual environment and pip install the downloaded file.此外,打开命令提示符,转到下载的路径激活您的虚拟环境并 pip 安装下载的文件。 This shall fix your issue.这将解决您的问题。

I had a similar problem... I was only able to fix it by downloading Visual Studio Build tools and installing the Visual C++ Build Tools, Windows 10 SDK, and VC++ 2015.3 v14我遇到了类似的问题......我只能通过下载 Visual Studio Build 工具并安装 Visual C++ Build Tools、Windows 10 SDK 和 VC++ 2015.3 v14 来修复它

在此处输入图片说明

Microsoft Visual C++ is required.需要 Microsoft Visual C++。 Get it with "Microsoft Visual C++ Build Tools": https://visualstudio.microsoft.com/downloads/使用“Microsoft Visual C++ 构建工具”获取它: https://visualstudio.microsoft.com/downloads/ : https://visualstudio.microsoft.com/downloads/

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

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