簡體   English   中英

在MacOS上安裝我的python軟件包會產生錯誤的Marshall數據錯誤

[英]Installing my python package on MacOS gives bad marshall data error

在Mac OS上安裝自己創建的python軟件包時,出現以下提到的錯誤的元數據錯誤。

deveshs-MacBook-Pro:mycli devesh$ sudo python setup-4.0.py install 
running install
Checking .pth file support in /Library/Python/2.7/site-packages/
/usr/bin/python -E -c pass
TEST PASSED: /Library/Python/2.7/site-packages/ appears to support .pth files
running bdist_egg
running egg_info
writing requirements to mycli.egg-info/requires.txt
writing cftcli.egg-info/PKG-INFO
writing top-level names to mycli.egg-info/top_level.txt
writing dependency_links to mycli.egg-info/dependency_links.txt
writing entry points to mycli.egg-info/entry_points.txt
reading manifest file 'mycli.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'mycli.egg-info/SOURCES.txt'
installing library code to build/bdist.macosx-10.10-intel/egg
running install_lib
running build_py
copying mycli.egg-info/PKG-INFO -> build/bdist.macosx-10.10-intel/egg/EGG-INFO
copying mycli.egg-info/SOURCES.txt -> build/bdist.macosx-10.10-intel/egg/EGG-INFO
copying mycli.egg-info/dependency_links.txt -> build/bdist.macosx-10.10-intel/egg/EGG-INFO
copying mycli.egg-info/entry_points.txt -> build/bdist.macosx-10.10-intel/egg/EGG-INFO
copying mycli.egg-info/requires.txt -> build/bdist.macosx-10.10-intel/egg/EGG-INFO
copying mycli.egg-info/top_level.txt -> build/bdist.macosx-10.10-intel/egg/EGG-INFO
zip_safe flag not set; analyzing archive contents...
Traceback (most recent call last):
  File "setup-4.0.py", line 42, in <module>
"requests==2.4.3",
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/core.py", line 152, in setup
dist.run_commands()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 953, in run_commands
self.run_command(cmd)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
  File "/Library/Python/2.7/site-packages/setuptools/command/install.py", line 67, in run
self.do_egg_install()
  File "/Library/Python/2.7/site-packages/setuptools/command/install.py", line 109, in do_egg_install
self.run_command('bdist_egg')
      File         "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/cmd.py", line 326, in run_command
self.distribution.run_command(command)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
  File "/Library/Python/2.7/site-packages/setuptools/command/bdist_egg.py", line 208, in run
os.path.join(archive_root, 'EGG-INFO'), self.zip_safe()
  File "/Library/Python/2.7/site-packages/setuptools/command/bdist_egg.py", line 244, in zip_safe
return analyze_egg(self.bdist_dir, self.stubs)
  File "/Library/Python/2.7/site-packages/setuptools/command/bdist_egg.py", line 354, in analyze_egg
safe = scan_module(egg_dir, base, name, stubs) and safe
  File "/Library/Python/2.7/site-packages/setuptools/command/bdist_egg.py", line 391, in scan_module
code = marshal.load(f)
ValueError: bad marshal data (unknown type code)

我嘗試從setuptools目錄中刪除所有* .pyc文件。 請指導如何解決此問題。 謝謝。

首先,我認為問題在於文件名,該文件名僅應為setup.py ,但在sudo python setup.py install也出現了相同的錯誤。

我發現的解決方法是先創建源分發。 在這里查看文檔

下面是可以正常工作的腳本,可以使我們擺脫上述問題。

cp -f setup-4.0.py setup.py
python setup.py sdist --format=zip,gztar
sudo pip install dist/mycli-4.0.tar.gz
rm setup.py 

卸載: sudo pip uninstall mycli

希望它將對某些Mac用戶有所幫助。 謝謝。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM