13691255250 发表于 2020-7-18 18:16:44

求问各路大神!我想将代码转为程序,但为啥如下操作会报错

我在cmd下运行pyinstaller.exe -F baidu.py(我是想将自己写的一个baidu.py变成一个程序)求问为什么出现如下报错?万分感谢大神们的指点

C:\Program Files\Python37>pyinstaller.exe -F baidu.py
Error processing line 1 of c:\program files\python37\lib\site-packages\matplotlib-3.2.2-py3.7-nspkg.pth:

Traceback (most recent call last):
    File "c:\program files\python37\lib\site.py", line 168, in addpackage
      exec(line)
    File "<string>", line 1, in <module>
    File "<frozen importlib._bootstrap>", line 580, in module_from_spec
AttributeError: 'NoneType' object has no attribute 'loader'

Remainder of file ignored
103 INFO: PyInstaller: 3.6
103 INFO: Python: 3.7.1
105 INFO: Platform: Windows-10-10.0.19041-SP0
107 INFO: wrote C:\Program Files\Python37\baidu.spec
115 INFO: UPX is not available.
118 INFO: Extending PYTHONPATH with paths
['C:\\Program Files\\Python37', 'C:\\Program Files\\Python37']
118 INFO: checking Analysis
213 INFO: checking PYZ
260 INFO: checking PKG
270 INFO: Building because C:\Program Files\Python37\build\baidu\baidu.exe.manifest changed
271 INFO: Building PKG (CArchive) PKG-00.pkg
2210 INFO: Building PKG (CArchive) PKG-00.pkg completed successfully.
2215 INFO: Bootloader c:\program files\python37\lib\site-packages\PyInstaller\bootloader\Windows-64bit\run.exe
2215 INFO: checking EXE
2219 INFO: Rebuilding EXE-00.toc because pkg is more recent
2219 INFO: Building EXE from EXE-00.toc
2222 INFO: Appending archive to EXE C:\Program Files\Python37\dist\baidu.exe
2231 INFO: Building EXE from EXE-00.toc completed successfully.

Twilight6 发表于 2020-7-18 18:23:14



你代码中有应该有错误,你更改下代码可以正常运行然后再进行打包操作试试?

13691255250 发表于 2020-7-18 18:49:04

我发现好像是我Python有问题。。。出现了这个情况

:\Users\Administrator>python
Error processing line 1 of C:\Program Files\Python37\lib\site-packages\matplotlib-3.2.2-py3.7-nspkg.pth:

Traceback (most recent call last):
    File "C:\Program Files\Python37\lib\site.py", line 168, in addpackage
      exec(line)
    File "<string>", line 1, in <module>
    File "<frozen importlib._bootstrap>", line 580, in module_from_spec
AttributeError: 'NoneType' object has no attribute 'loader'

Remainder of file ignored
Python 3.7.1 (v3.7.1:260ec2c36a, Oct 20 2018, 14:57:15) on win32
Type "help", "copyright", "credits" or "license" for more information.

13691255250 发表于 2020-7-18 18:49:47

求问怎么解决呀

zltzlt 发表于 2020-7-18 18:50:59

可以参考一下:https://blog.csdn.net/changreal/article/details/96856628

zltzlt 发表于 2020-7-18 18:53:36

13691255250 发表于 2020-7-18 18:49
求问怎么解决呀

重装试试。。

我真的是个好人 发表于 2020-7-18 20:27:16

打包没问题,应该是代码的问题,你把你打包的代码发出来我打包试试

xiaofeiyu 发表于 2020-7-18 21:08:37

既然报错traceback,并且有文件名,那就是代码问题。
页: [1]
查看完整版本: 求问各路大神!我想将代码转为程序,但为啥如下操作会报错