@
cls1991 装的是 anaconda2.7,环境变量也配置了,就想用个 pip list,结果就给我报错,D:\Anaconda2\Lib\
ntpath.py 87 行 报错,result_path = result_path + p_path 就这里。然后加了个“ reload(sys)
sys.setdefaultencoding('gbk')”就正常了
·# Join two (or more) paths.
def join(path, *paths):
reload(sys)
sys.setdefaultencoding('gbk')
"""Join two or more pathname components, inserting "\\" as needed."""
result_drive, result_path = splitdrive(path)
for p in paths:
p_drive, p_path = splitdrive(p)
if p_path and p_path[0] in '\\/':
# Second path is absolute
if p_drive or not result_drive:
result_drive = p_drive
result_path = p_path
continue
elif p_drive and p_drive != result_drive:
if p_drive.lower() != result_drive.lower():
# Different drives => ignore the first path entirely
result_drive = p_drive
result_path = p_path
continue
# Same drive in different case
result_drive = p_drive
# Second path is relative to the first
if result_path and result_path[-1] not in '\\/':
result_path = result_path + '\\'
result_path = result_path + p_path
## add separator between UNC and non-absolute path
if (result_path and result_path[0] not in '\\/' and
result_drive and result_drive[-1:] != ':'):
、