Python,Nuitka,打包Paddle和Paddleocr,test.dist\\paddle\\fluid\\..\\libs‘;

Python版本3.9,Nuitka版本1.8.6,paddleocr版本2.6.1.3,paddlepaddle版本2.5.2

Nuitka打包后提示报错

File "C:\Users\Administrator\Desktop\XXX\XXX\test.dist\os.py", line 1111, in add_dll_directory
FileNotFoundError: [WinError 2] 系统找不到指定的文件。: 'C:\\Users\\Administrator\\Desktop\\XXX\\XXX\\test.dist\\paddle\\fluid\\..\\libs'

把Paddle复制到文件夹内,继续报错

File "D:\XXX\XXX.dist\paddle\fluid\core.py", line 376, in set_paddle_lib_path
lib_dir = os.path.sep.join([site.USER_SITE, 'paddle', 'libs'])
TypeError: sequence item 0: expected str instance, NoneType found

解决方案:

你的python路径\Lib\site-packages\paddle\fluid\core.py,大概380行

if hasattr(site, 'USER_SITE')

改为

if hasattr(site, 'USER_SITE') and site.USER_SITE: 

然后重新打包就可以了

你可能感兴趣的:(python,paddle,开发语言)