【问题标题】:'python setup.py bdist' gets error on 'compiler_flags'“python setup.py bdist”在“compiler_flags”上出现错误
【发布时间】:2020-12-22 22:58:21
【问题描述】:

Windows 2016 和以下官方文档中,我已经成功 compiled source code of Python-3.6.12。在尝试build distribution 时,我收到以下错误,抱怨 compiler_flags

还要注意这是编译源代码,命令python实际上调用了主目录下的python.bat

如果您需要更多详细信息,请告诉我,我们将不胜感激任何帮助或指点。

截图:
(python版本和异常回溯,来自CMD)

D:\Python\Python36>python -V
Running Release|x64 interpreter...
Python 3.6.12

D:\Python\Python36>python setup.py bdist
Running Release|x64 interpreter...
Traceback (most recent call last):
File "setup.py", line 29, in <module>
set_compiler_flags('CFLAGS', 'PY_CFLAGS_NODIST')
File "setup.py", line 27, in set_compiler_flags
sysconfig.get_config_vars()[compiler_flags] = flags + ' ' + py_flags_nodist
TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'

D:\Python\Python36>

更多信息:
我现在已经安装了 pip、setuptools、wheel,并将“D:\Python\Python36”和“D:\Python\Python36”的目录添加到 Path。但是 bdist 上的错误保持不变。我是 Python 源代码发布的新手,所以感谢您的帮助和耐心。

截图:

D:\Python\Python36>python -m pip install --upgrade setuptools wheel
Running Release|x64 interpreter...
Requirement already up-to-date: setuptools in d:\python\python36\lib\site-packages (50.1.0)
Requirement already up-to-date: wheel in d:\python\python36\lib\site-packages (0.35.1)

...
D:\Python\Python36>python setup.py bdist
Running Release|x64 interpreter...
Traceback (most recent call last):
  ... the same error as before ...

【问题讨论】:

  • 试试:pip install --upgrade setuptools wheel
  • 谢谢你,@KetZoomer,我已经按照你的提示安装了 pip、setuptools 和 wheel,它有点帮助。但错误仍然显示在 bdist 上。
  • 你能给我们看看你的 setup.py
  • 你能看到setup.py on the official github repo吗?我对比了一下,和我本地的实例是一样的。

标签: python windows python-3.6


【解决方案1】:

您在尝试添加“NoneType”值和“str”值时似乎出错了。如果这些是您想要连接的值,那么您应该使用:

variable = ''.join(value 1, value 2)

【讨论】:

  • 嗨@balexander1,错误消息显示“文件“setup.py”,第27行,在set_compiler_flags中”,文件setup.py来自official source release的Python-3.6.12.tgz。你的意思是修改文件setup.py?
猜你喜欢
  • 1970-01-01
  • 2023-03-14
  • 2023-03-10
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-07-02
相关资源
最近更新 更多