繁体   English   中英

尝试使用setup.py安装Cryptodome时出现错误消息

[英]Error message when trying to install Cryptodome using setup.py

我正在Windows 7 64位计算机上设置python的cryptodome。 我正在使用setup.py模块来实现此目的。 我使用setup.py而不是pip的原因是因为我正在安装该程序的计算机没有外部Internet访问,因此pip无法正常工作。

我已经使用Windows SDK安装了64位c ++编译器,并按照以下链接中阐明的说明在cmd行上运行了以下命令。

  • 列表项cd“ C:\\ Program Files \\ Microsoft SDKs \\ Windows \\ v7.1”
  • 列表项cmd / V:ON / K Bin \\ SetEnv.Cmd / x64 / release
  • 清单项目集DISTUTILS_USE_SDK = 1

当我运行setup.py时,出现以下错误消息:

  File "setup.py", line 443, in <module>
    set_compiler_options(package_root, ext_modules)
  File "C:\Python33\cryptodome\pycryptodome-3.8.2\compiler_opt.py", line 304, in
 set_compiler_options
    clang = compiler_is_clang()
  File "C:\Python33\cryptodome\pycryptodome-3.8.2\compiler_opt.py", line 239, in
 compiler_is_clang
    return test_compilation(source, msg="clang")
  File "C:\Python33\cryptodome\pycryptodome-3.8.2\compiler_opt.py", line 82, in
test_compilation
    objects = compiler.compile([fname], extra_postargs=extra_cc_options)
  File "C:\Python33\lib\distutils\msvc9compiler.py", line 461, in compile
    self.initialize()
  File "C:\Python33\lib\distutils\msvc9compiler.py", line 372, in initialize
    vc_env = query_vcvarsall(VERSION, plat_spec)
  File "C:\Python33\lib\distutils\msvc9compiler.py", line 288, in query_vcvarsal
    raise ValueError(str(list(result.keys())))
ValueError: ['path']

这是看起来与错误相关的代码:

    #looks to contain a set of possible environment variable names
    interesting = set(("include", "lib", "libpath", "path"))


    #populates result with keys and values from actual environment variables
    stdout = stdout.decode("mbcs")
            for line in stdout.split("\n"):
                line = Reg.convert_mbcs(line)
                if '=' not in line:
                    continue
                line = line.strip()
                key, value = line.split('=', 1)
                key = key.lower()
                if key in interesting:
                    if value.endswith(os.pathsep):
                        value = value[:-1]
                    result[key] = removeDuplicates(value)


    #tests whether all the keys within result are in interesting
    if len(result) != len(interesting):
         raise ValueError(str(list(result.keys())))

这可能是由于环境变量中缺少某些值造成的吗? 如果是这样,这些价应是什么?

尽管错误消息不是很有帮助,但我通过将3个值添加到机器上的环境变量中来解决了这个问题:lib,include,libpath(路径已添加)。

暂无
暂无

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

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