我正在尝试安装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:]发布于 2016-04-01 17:49:52
正如Martijn Pieters在注释中正确推断的那样,我的Python安装以某种方式损坏。我安装了Python的最新版本(2.7.11),现在一切正常。
https://stackoverflow.com/questions/36362253
复制相似问题