python-3.x 出现错误“packaging”,version.InvalidVersion:无效版本:在linux中执行pyinstaller创建的exe时出现“'None'”

uxhixvfz  于 2023-05-02  发布在  Python
关注(0)|答案(1)|浏览(976)

使用以下csv文件csv file

import datetime
import pandas as pd
import numpy as np
# import xarray as xr

import holoviews as hv
import colorcet as cc

df = pd.read_csv('./grant.csv')
print(df.head())
df_2012 = df.loc[df['year']==2012, :].copy()

hv.Points(
    data=df_2012,
    kdims=['beak length (mm)', 'beak depth (mm)'],
    vdims=['species'],
)

在使用以下命令创建exe后,我可以得到exe文件里面

pyinstaller grant.py

ls dist/grant/grant
在运行this exe时。/grant我收到以下错误

Traceback (most recent call last):
  File "grant.py", line 7, in <module>
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "PyInstaller/loader/pyimod03_importers.py", line 495, in exec_module
  File "holoviews/__init__.py", line 11, in <module>
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "PyInstaller/loader/pyimod03_importers.py", line 495, in exec_module
  File "holoviews/util/__init__.py", line 15, in <module>
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "PyInstaller/loader/pyimod03_importers.py", line 495, in exec_module
  File "holoviews/core/__init__.py", line 3, in <module>
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "PyInstaller/loader/pyimod03_importers.py", line 495, in exec_module
  File "holoviews/core/boundingregion.py", line 12, in <module>
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "PyInstaller/loader/pyimod03_importers.py", line 495, in exec_module
  File "holoviews/core/util.py", line 53, in <module>
  File "packaging/version.py", line 266, in __init__
packaging.version.InvalidVersion: Invalid version: 'None'
[1396395] Failed to execute script 'grant' due to unhandled exception!

请在这方面给予帮助。

ljsrvy3e

ljsrvy3e1#

看起来您需要在pyinstaller命令中使用param包上的--collect-all标志。
例如:

pyinstaller -F --collect-all param grant.py

或者,如果不想将-F编译为单个文件,也可以省略它。

相关问题