使用PIP安装Python包导致LINK:致命错误LNK1104:无法打开文件' python27.lib'

时间:2015-06-21 04:13:23

标签: python visual-studio-2010 visual-studio pip

我试图让PIP安装Twisted但我收到此LINK错误。
我使用64位Windows 8和python 2.7.10。 我认为这个问题与Visual Studio编译器有关。我有2009年和2010年,但我不确定它使用的是哪一个。我已经查看了大量有关此问题和Visual Studio的stackoverflow帖子。但没有一个真正帮助过我。我尝过以下的东西:

Cannot find vcvarsall.bat when running a Python script

Errors while building/installing C module for Python 2.7

我实际上也遇到过cffi和密码学的这个问题,但是我使用了轮子并通过它安装了那些包的轮子文件。这是一个解决方法......但对于Twisted 10.0.0,没有轮盘文件,所以我无法解决它。

这是消息发出之前的最后一点消息。

reading manifest file 'Twisted.egg-info\SOURCES.txt'

writing manifest file 'Twisted.egg-info\SOURCES.txt'

creating build\lib.win-amd64-2.7\twisted\internet\iocpreactor\iocpsupport

copying twisted\internet/iocpreactor/iocpsupport\iocpsupport.c -> build\lib.win-amd64-2.7\twisted\internet/iocpreactor/iocpsupport

copying twisted\internet/iocpreactor/iocpsupport\winsock_pointers.c -> build\lib.win-amd64-2.7\twisted\internet/iocpreactor/iocpsupport

copying twisted\python\sendmsg.c -> build\lib.win-amd64-2.7\twisted\python

copying twisted\runner\portmap.c -> build\lib.win-amd64-2.7\twisted\runner

copying twisted\test\raiser.c -> build\lib.win-amd64-2.7\twisted\test

running build_ext

C:\Users\Andrew\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -IC:\Users\Andrew\.virtualenvs\adventure_time\include -IC:\Users\Andrew\.virtualenvs\adventure_time\PC /Tcconftest.c /Foconftest.obj

conftest.c

conftest.c(1) : fatal error C1083: Cannot open include file: 'rpc/rpc.h': No such file or directory

building 'twisted.test.raiser' extension

creating build\temp.win-amd64-2.7

creating build\temp.win-amd64-2.7\Release

creating build\temp.win-amd64-2.7\Release\twisted

creating build\temp.win-amd64-2.7\Release\twisted\test

C:\Users\Andrew\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -DWIN32=1 -IC:\Users\Andrew\.virtualenvs\adventure_time\include -IC:\Users\Andrew\.virtualenvs\adventure_time\PC /Tctwisted/test/raiser.c /Fobuild\temp.win-amd64-2.7\Release\twisted/test/raiser.obj

raiser.c

C:\Users\Andrew\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\link.exe /DLL /nologo /INCREMENTAL:NO /LIBPATH:C:\Users\Andrew\.virtualenvs\adventure_time\libs /LIBPATH:C:\Users\Andrew\.virtualenvs\adventure_time\PCbuild\amd64 /EXPORT:initraiser build\temp.win-amd64-2.7\Release\twisted/test/raiser.obj /OUT:build\lib.win-amd64-2.7\twisted\test\raiser.pyd /IMPLIB:build\temp.win-amd64-2.7\Release\twisted/test\raiser.lib /MANIFESTFILE:build\temp.win-amd64-2.7\Release\twisted/test\raiser.pyd.manifest

LINK : fatal error LNK1104: cannot open file 'python27.lib'

error: command 'C:\\Users\\Andrew\\AppData\\Local\\Programs\\Common\\Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin\\amd64\\link.exe' failed with exit status 1104

----------------------------------------

Cleaning up...

  Removing temporary dir c:\users\andrew\appdata\local\temp\pip_build_Andrew...
Command C:\Users\Andrew\.virtualenvs\adventure_time\Scripts\python.exe -c "import setuptools;__file__='c:\\users\\andrew\\appdata\\local\\temp\\pip_build_Andrew\\twisted\\setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record c:\users\andrew\appdata\local\temp\pip-b8elqk-record\install-record.txt --single-version-externally-managed failed with error code 1 in c:\users\andrew\appdata\local\temp\pip_build_Andrew\twisted

Exception information:
Traceback (most recent call last):
  File "C:\Users\Andrew\.virtualenvs\adventure_time\lib\site-packages\pip\basecommand.py", line 134, in main
    status = self.run(options, args)
  File "C:\Users\Andrew\.virtualenvs\adventure_time\lib\site-packages\pip\commands\install.py", line 241, in run
    requirement_set.install(install_options, global_options, root=options.root_path)
  File "C:\Users\Andrew\.virtualenvs\adventure_time\lib\site-packages\pip\req.py", line 1298, in install
    requirement.install(install_options, global_options, *args, **kwargs)
  File "C:\Users\Andrew\.virtualenvs\adventure_time\lib\site-packages\pip\req.py", line 625, in install
    cwd=self.source_dir, filter_stdout=self._filter_install, show_stdout=False)
  File "C:\Users\Andrew\.virtualenvs\adventure_time\lib\site-packages\pip\util.py", line 670, in call_subprocess
    % (command_desc, proc.returncode, cwd))
InstallationError: Command C:\Users\Andrew\.virtualenvs\adventure_time\Scripts\python.exe -c "import setuptools;__file__='c:\\users\\andrew\\appdata\\local\\temp\\pip_build_Andrew\\twisted\\setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record c:\users\andrew\appdata\local\temp\pip-b8elqk-record\install-record.txt --single-version-externally-managed failed with error code 1 in c:\users\andrew\appdata\local\temp\pip_build_Andrew\twisted

2 个答案:

答案 0 :(得分:0)

尝试安装C编译器https://www.microsoft.com/en-us/download/details.aspx?id=44266。您可能需要安装Cython。

答案 1 :(得分:0)

您可以安装MinGW。

  1. 您需要安装MinGW。
  2. 添加变量PATH,MinGW的路径
  3. 在C:\ Python27 \ Lib \ distutils中创建一个空的distutils.cfg文件。
  4. 在文件类型中:

    [构建] 编译器的mingw32 =