安装pythonchess失败:“UnboundLocalError:赋值前引用的局部变量'distclass'”

2024-09-29 21:50:55 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试安装python-chess(windows7上的python2.7)。你知道吗

我得到以下错误:

C:\Users\Jeroen>pip install python-chess
Collecting python-chess
c:\python27\lib\site-packages\pip\_vendor\requests\packages\urllib3\util\ssl_.py:315: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may caus
e the server to present an incorrect TLS certificate, which can cause validation failures. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#snimissingwarning.
  SNIMissingWarning
c:\python27\lib\site-packages\pip\_vendor\requests\packages\urllib3\util\ssl_.py:120: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL con
nections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
  Using cached python-chess-0.13.2.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "c:\users\jeroen\appdata\local\temp\pip-build-2eph1o\python-chess\setup.py", line 91, in <module>
        "Topic :: Software Development :: Libraries :: Python Modules",
      File "c:\python27\lib\distutils\core.py", line 98, in setup
        klass = distclass
    UnboundLocalError: local variable 'distclass' referenced before assignment

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in c:\users\jeroen\appdata\local\temp\pip-build-2eph1o\python-chess\

当我再次运行pip install python-chess时,SNIMissingWarning不再出现,但UnboundLocalError仍然存在。你知道吗

编辑

对评论中问题的回答:

Python 2.7.3 |EPD_free 7.3-2 (32-bit)| (default, Apr 12 2012, 14:30:37) [MSC v.1500 32 bit (Intel)] on win32
Type "credits", "demo" or "enthought" for more information.
>>> import distutils
>>> print distutils.__version__
2.7.3
>>>

第90行的C:\Python27\Lib\distutils\core.py如下所示:

global _setup_stop_after, _setup_distribution

# Determine the distribution class -- either caller-supplied or
# our Distribution (see below).
klass = distclass
if klass:
    del distclass
else:
    klass = Distribution

if 'script_name' not in attrs:
    script_name = os.path.basename(sys.argv[0])
if 'script_args' not in attrs:
    script_args = sys.argv[1:]

Tags: pipinpylibpackagessetupscriptnot

热门问题