Python 设置禁用路径长度限制的优缺点? [英] Python Setup Disabling Path Length Limit Pros and Cons?

查看:1769
本文介绍了Python 设置禁用路径长度限制的优缺点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近安装了 Python 3.7,在安装结束时,有禁用路径长度限制"的选项.我不知道我是否应该这样做.

I recently installed Python 3.7 and at the end of the setup, there is the option to "Disable path length limit". I don't know whether or not I should do this.

这样做的利弊是什么?仅从它的声音来看,您应该始终禁用它.

What are the pros and cons of doing this? Just from the sound of it you should always disable it.

推荐答案

我建议选择该选项,从而消除路径长度限制.它可能会在将来为您节省调试可避免问题的时间.

I recommend selecting that option and thereby removing the path length limit. It will potentially save you time in future on debugging an avoidable issue.

这是我是如何知道这件事的轶事:

Here is an anecdote of how I came to know about it:

在编译我的程序(Windows 机器上的 C# 代码)期间,我开始收到以下错误:

During the compilation of my program (C# code on a Windows machine), I started getting the following error:

error MSB3541: Files has invalid value "long\path\filename". The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.

这个错误不允许我构建我的项目,这个问题唯一明显的解决方案是缩短我的路径/文件名.原来这个错误是 NTFS(窗口文件系统)中的一个内置限制:为什么 Windows 中存在 260 个字符的路径长度限制?

This error was not allowing me to build my project and the only apparent solution to this issue was to shorten my path/file names. Turns out that this bug is a built-in limitation in NTFS (Window's File System): Why does the 260 character path length limit exist in Windows?

在 NTFS 文件系统中内置限制几十年后,它终于在 Windows 10 中得到修复(基于 Unix 的系统没有它)(https://docs.microsoft.com/en-us/windows/desktop/FileIO/naming-a-file#maximum-path-length-limitation),但它不会自动启用,并且需要注册表(或组策略)设置来执行此操作.Python 选项允许您为 Python 库禁用它,从而为您省去很多麻烦.

After a couple of decades with the limitation built into the NTFS file system, it has finally been fixed (Unix based system did not have it) in Windows 10 (https://docs.microsoft.com/en-us/windows/desktop/FileIO/naming-a-file#maximum-path-length-limitation), but it is not enabled automatically, and needs registry (or group policy) settings to do this. The Python option allows you to disable it for Python libraries, saving you a lot of headache.

请注意,启用此选项将,

Do note that enabling this option will,

a) 当使用长文件/目录名称和路径时,会破坏您的程序在使用旧版 Windows 10 及更低版本的系统上的兼容性.

a) break compatibility of your programs on systems using older versions of Windows 10 and lower, when using long file/directory names and paths.

b) 使用长文件/目录名称和路径时,在未启用此选项的 Windows 10 机器上中断程序.

b) break programs on Windows 10 machines not having this option enabled, when using long file/directory names and paths.

这篇关于Python 设置禁用路径长度限制的优缺点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆