在利用Windows PowerShell安装pathlib时失败,报错如下: pip install pathlib
Looking in indexes: https://pypi.douban.com/simple
Collecting pathlib
Downloading https://pypi.doubanio.com/packages/ac/aa/9b065a76b9af472437a0059f77e8f962fe350438b927cb80184c32f075eb/pathlib-1.0.1.tar.gz (49 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 49.3/49.3 KB 630.0 kB/s eta 0:00:00
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [20 lines of output]
Traceback (most recent call last):
File "<string>", line 36, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "C:\Users\Administrator\AppData\Local\Temp\pip-install-y37hw6eo\pathlib_636283eb730242dda24c3a2553aab516\setup.py", line 30, in <module>
url='https://pathlib.readthedocs.org/',
File "D:\rj\anaconda3\lib\site-packages\setuptools\_distutils\core.py", line 109, in setup
_setup_distribution = dist = klass(attrs)
File "D:\rj\anaconda3\lib\site-packages\setuptools\dist.py", line 460, in __init__
for ep in metadata.entry_points(group='distutils.setup_keywords'):
File "D:\rj\anaconda3\lib\site-packages\setuptools\_vendor\importlib_metadata\__init__.py", line 999, in entry_points
return SelectableGroups.load(eps).select(**params)
File "D:\rj\anaconda3\lib\site-packages\setuptools\_vendor\importlib_metadata\__init__.py", line 449, in load
ordered = sorted(eps, key=by_group)
File "D:\rj\anaconda3\lib\site-packages\setuptools\_vendor\importlib_metadata\__init__.py", line 997, in <genexpr>
dist.entry_points for dist in unique(distributions())
File "D:\rj\anaconda3\lib\site-packages\setuptools\_vendor\importlib_metadata\__init__.py", line 609, in entry_points
return EntryPoints._from_text_for(self.read_text('entry_points.txt'), self)
File "D:\rj\anaconda3\lib\site-packages\setuptools\_vendor\importlib_metadata\__init__.py", line 917, in read_text
return self._path.joinpath(filename).read_text(encoding='utf-8')
AttributeError: 'WindowsPath' object has no attribute 'read_text'
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
× Encountered error while generating package metadata.
╰─> See above for output.
note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
通过在Anaconda Prompt里输入以下命令得以解决:
conda install pathlib
|