【版权所有,转载请注明出处】
问题描述:运行python程序,在import语句部分出现:ValueError: source code string cannot contain null bytes
错误
网络搜索出来的结果:
解决方案:linux下面运行sed -i s/\\x0//g Filename
测试方法:无效
问题回想:本机安装python 3的时候有一个
Disable path length limit的选项,但是服务器上安装的时候没有,所有猜测与这个有关。
查看系统配置:本机(Win 10 1709)服务器(Win10 1511)
检索到的帖子:http://mspoweruser.com/ntfs-260-character-windows-10/
Open Group Policy Editor (Press Windows Key and typegpedit.mscand hitEnterkey.
Navigate to the following directory:Local Computer Policy Computer Configuration Administrative Templates System Filesystem NTFS.
ClickEnable NTFS long pathsoption and enable it.
来自 http://mspoweruser.com/ntfs-260-character-windows-10/
查看本机的配置【计算机配置-管理模板-文件系统】
查看服务器的竟然没有这个
好吧,所以问题的解决方案来了。
想方设法把path(from module import * 中的module的路径)的长度改短一些(比如重命名,比如移动文件夹and so on)。果然,问题迎刃而解!
转载本文请联系原作者获取授权,同时请注明本文来自于留传科学网博客。
链接地址:http://blog.sciencenet.cn/blog-3373964-1101916.html
上一篇:尾部的零
本文链接: http://maxsource16.immuno-online.com/view-708009.html