繁体   English   中英

ImportError:无法使用python 2.7.12找到vcvarsall.bat

[英]ImportError: Unable to find vcvarsall.bat with python 2.7.12

我是python的新手,我想在Windows 64位上的python 2.7.12中使用模块“ lic_internal”,但出现以下错误:

Traceback (most recent call last):
  File "04_report.py", line 32, in <module>
import utils_show as ushow
  File "./libs\utils_show.py", line 45, in <module>
import lic_internal
  File "D:\Programme\Python27\lib\site-packages\pyximport\pyximport.py", line 445, in load_module language_level=self.language_level)
  File "D:\Programme\Python27\lib\site-packages\pyximport\pyximport.py", line 234, in load_module exec("raise exc, None, tb", {'exc': exc, 'tb': tb})
  File "D:\Programme\Python27\lib\site-packages\pyximport\pyximport.py", line 216, in load_module inplace=build_inplace, language_level=language_level)
  File "D:\Programme\Python27\lib\site-packages\pyximport\pyximport.py", line 192, in build_module reload_support=pyxargs.reload_support)
  File "D:\Programme\Python27\lib\site-packages\pyximport\pyxbuild.py", line 102, in pyx_to_dll dist.run_commands()
  File "D:\Programme\Python27\lib\distutils\dist.py", line 953, in run_commands self.run_command(cmd)
  File "D:\Programme\Python27\lib\distutils\dist.py", line 972, in run_command cmd_obj.run()
  File "D:\Programme\Python27\lib\site-packages\Cython\Distutils\build_ext.py", line 164, in run _build_ext.build_ext.run(self)
  File "D:\Programme\Python27\lib\distutils\command\build_ext.py", line 339, in run self.build_extensions()
  File "D:\Programme\Python27\lib\site-packages\Cython\Distutils\build_ext.py", line 172, in build_extension self.build_extension(ext)
  File "D:\Programme\Python27\lib\distutils\command\build_ext.py", line 498, in build_extension depends=ext.depends)
  File "D:\Programme\Python27\lib\distutils\msvc9compiler.py", line 474, in compile self.initialize()
  File "D:\Programme\Python27\lib\distutils\msvc9compiler.py", line 384, in initialize vc_env = query_vcvarsall(VERSION, plat_spec)
  File "D:\Programme\Python27\lib\distutils\msvc9compiler.py", line 272, in query_vcvarsall raise DistutilsPlatformError("Unable to find vcvarsall.bat")

ImportError: Building module lic_internal failed: ['DistutilsPlatformError: Unable to find vcvarsall.bat\n']

我已经安装了“ Visual C ++ for Python 2.7”,并尝试按以下方式更改“ Python27 \\ lib \\ distutils \\ msvc9compiler.py”中的路径:

def query_vcvarsall(version, arch="x86"):
"""Launch vcvarsall.bat and read the settings from its environment
"""
vcvarsall = find_vcvarsall(version)
vcvarsall = "C:/Users/Christian/AppData/Local/Programs/Common/Microsoft/Visual C++ for Python/9.0" + "/vcvarsall.bat"
interesting = set(("include", "lib", "libpath", "path"))

这意味着我在“ vcvarsall”中保存了确切的路径。

然后我得到以下错误:

Traceback (most recent call last):
File "04_report.py", line 32, in <module> import utils_show as ushow
File "./libs\utils_show.py", line 45, in <module> import lic_internal
File "D:\Programme\Python27\lib\site-packages\pyximport\pyximport.py", line 445, in load_module language_level=self.language_level)
File "D:\Programme\Python27\lib\site-packages\pyximport\pyximport.py", line 234, in load_module exec("raise exc, None, tb", {'exc': exc, 'tb': tb})
File "D:\Programme\Python27\lib\site-packages\pyximport\pyximport.py", line 216, in load_module inplace=build_inplace, language_level=language_level)
File "D:\Programme\Python27\lib\site-packages\pyximport\pyximport.py", line 192, in build_module reload_support=pyxargs.reload_support)
File "D:\Programme\Python27\lib\site-packages\pyximport\pyxbuild.py", line 102, in pyx_to_dll dist.run_commands()
File "D:\Programme\Python27\lib\distutils\dist.py", line 953, in run_commands self.run_command(cmd)
File "D:\Programme\Python27\lib\distutils\dist.py", line 972, in run_command cmd_obj.run()
File "D:\Programme\Python27\lib\site-packages\Cython\Distutils\build_ext.py", line 164, in run _build_ext.build_ext.run(self)
File "D:\Programme\Python27\lib\distutils\command\build_ext.py", line 339, in run self.build_extensions()
File "D:\Programme\Python27\lib\site-packages\Cython\Distutils\build_ext.py", line 172, in build_extensions self.build_extension(ext)
File "D:\Programme\Python27\lib\distutils\command\build_ext.py", line 498, in build_extension depends=ext.depends)
File "D:\Programme\Python27\lib\distutils\msvc9compiler.py", line 549, in compile raise CompileError(msg)  

ImportError: Building module lic_internal failed: ["CompileError: command 'C:\\\\Users\\\\Christian\\\\AppData\\\\Local\\Programs\\\\Common\\\\Microsoft\\\\Visual C++ for Python\\\\9.0\\\\VC\\\\Bin\\\\cl.exe' failed with exit status 2\n"]

此外,我在计算机上安装了Visual C ++ 2013,但是当我下载python的C ++编译器软件包时,应该没有必要,对吗?

如果您仍然有问题,可以通过卸载系统中的其他python来解决。 为了确保您需要使用https://stackoverflow.com/a/30272728/7497110定义要使用的python的路径,然后打开msvc9compiler.py并执行此操作https://github.com/cython/ cython / wiki / CythonExtensionsOnWindows 然后,您可能会遇到众所周知的头文件问题(即* .h没有此类文件或目录)。 在这种情况下,您可以使用http://www.pythonlibrary.org/notes/open_glcontext_notes.htm中的说明。 请记住要更新python,尤其是distutils和numpy。 请让我知道问题是否解决。

暂无
暂无

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

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