NSIS:无法导入修补程序
NSIS: can't import tinker
我想构建使用 matplotlib
的程序,这需要 tkinter
。
问题是我不能包含 tkinter
,因为它不在 pyPi 上(它现在有轮子)。
我使用 Pynsist 构建 NSIS 安装程序。这是配置文件:
[Application]
name=SineWave
version=1.0
# How to launch the app - this calls the 'main' function from the 'myapp' package:
entry_point=main:main
icon=sinewave.ico
[Python]
version=3.6.5
[Include]
# Packages from PyPI that your application requires, one per line
# These must have wheels on PyPI:
pypi_wheels = numpy==1.16.1
matplotlib==3.0.3
pyparsing==2.4.0
cycler==0.10.0
six==1.11.0
python-dateutil==2.8.0
kiwisolver==1.0.1
anaconda-project==0.8.2
如果我运行构建的exe它returns这个:
Traceback (most recent call last):
File "C:\Users\Novot\AppData\Local\SineWave\SineWave.launch.pyw", line 31, in <module>
from main import main
File "C:\Users\Novot\AppData\Local\SineWave\pkgs\main.py", line 2, in <module>
import matplotlib.pyplot as plt
File "C:\Users\Novot\AppData\Local\SineWave\pkgs\matplotlib\pyplot.py", line 2372, in <module>
switch_backend(rcParams["backend"])
File "C:\Users\Novot\AppData\Local\SineWave\pkgs\matplotlib\pyplot.py", line 207, in switch_backend
backend_mod = importlib.import_module(backend_name)
File "importlib\__init__.py", line 126, in import_module
File "C:\Users\Novot\AppData\Local\SineWave\pkgs\matplotlib\backends\backend_tkagg.py", line 1, in <module>
from . import _backend_tk
File "C:\Users\Novot\AppData\Local\SineWave\pkgs\matplotlib\backends\_backend_tk.py", line 5, in <module>
import tkinter as Tk
ModuleNotFoundError: No module named 'tkinter'
还有,有没有办法导入另一个库需要的所有库?
我在文档中找到了它:
Pynsist documentation
"Because Pynsist makes use of the “bundled” versions of Python the tkinter module isn’t included by default. If your application relies on tkinter for a GUI then you need to find the following assets..."
我想构建使用 matplotlib
的程序,这需要 tkinter
。
问题是我不能包含 tkinter
,因为它不在 pyPi 上(它现在有轮子)。
我使用 Pynsist 构建 NSIS 安装程序。这是配置文件:
[Application]
name=SineWave
version=1.0
# How to launch the app - this calls the 'main' function from the 'myapp' package:
entry_point=main:main
icon=sinewave.ico
[Python]
version=3.6.5
[Include]
# Packages from PyPI that your application requires, one per line
# These must have wheels on PyPI:
pypi_wheels = numpy==1.16.1
matplotlib==3.0.3
pyparsing==2.4.0
cycler==0.10.0
six==1.11.0
python-dateutil==2.8.0
kiwisolver==1.0.1
anaconda-project==0.8.2
如果我运行构建的exe它returns这个:
Traceback (most recent call last):
File "C:\Users\Novot\AppData\Local\SineWave\SineWave.launch.pyw", line 31, in <module>
from main import main
File "C:\Users\Novot\AppData\Local\SineWave\pkgs\main.py", line 2, in <module>
import matplotlib.pyplot as plt
File "C:\Users\Novot\AppData\Local\SineWave\pkgs\matplotlib\pyplot.py", line 2372, in <module>
switch_backend(rcParams["backend"])
File "C:\Users\Novot\AppData\Local\SineWave\pkgs\matplotlib\pyplot.py", line 207, in switch_backend
backend_mod = importlib.import_module(backend_name)
File "importlib\__init__.py", line 126, in import_module
File "C:\Users\Novot\AppData\Local\SineWave\pkgs\matplotlib\backends\backend_tkagg.py", line 1, in <module>
from . import _backend_tk
File "C:\Users\Novot\AppData\Local\SineWave\pkgs\matplotlib\backends\_backend_tk.py", line 5, in <module>
import tkinter as Tk
ModuleNotFoundError: No module named 'tkinter'
还有,有没有办法导入另一个库需要的所有库?
我在文档中找到了它: Pynsist documentation
"Because Pynsist makes use of the “bundled” versions of Python the tkinter module isn’t included by default. If your application relies on tkinter for a GUI then you need to find the following assets..."