我对python很新,我想使用模块" lic_internal"在Windows 64bit上使用python 2.7.12但我收到以下错误:
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']
我已经安装了&#34; Visual C ++ for Python 2.7&#34;并试图改变&#34; Python27 \ lib \ distutils \ msvc9compiler.py&#34;中的路径。如下:
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"))
这意味着我保存在&#34; vcvarsall&#34;确切的路径。
然后我收到以下错误:
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 ++编译器包时,它不是必需的,对吧?
答案 0 :(得分:-1)
如果你还有问题,我通过卸载系统中的其他pythons来解决它。为了保证您需要使用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。如果问题解决了,请告诉我。