我是新编程人员,当我尝试将.py文件转换为可执行.exe文件时,出现以下错误。
我的numpy版本是1.19.1(我已经将其卸载并重新安装)。
我的Anaconda版本是1.9.12
PYTHONPATH正常。
尝试获取.exe文件时出现以下错误:
Running auto-py-to-exe v2.7.6
Building directory: C:\Users\User\AppData\Local\Temp\tmp30rpmpfm
Provided command: pyinstaller --noconfirm --onedir --windowed "C:/Users/User/Documents/Python/Scripts/Italiano/conjugacion_verbos_presente/auxiliar.py"
Recursion Limit is set to 5000
Executing: pyinstaller --noconfirm --onedir --windowed C:/Users/User/Documents/Python/Scripts/Italiano/conjugacion_verbos_presente/auxiliar.py --distpath C:\Users\User\AppData\Local\Temp\tmp30rpmpfm\application --workpath C:\Users\User\AppData\Local\Temp\tmp30rpmpfm\build --specpath C:\Users\User\AppData\Local\Temp\tmp30rpmpfm
520727 INFO: PyInstaller: 3.6
520732 INFO: Python: 3.7.6 (conda)
520736 INFO: Platform: Windows-10-10.0.18362-SP0
520746 INFO: wrote C:\Users\User\AppData\Local\Temp\tmp30rpmpfm\auxiliar.spec
520753 INFO: UPX is not available.
520761 INFO: Extending PYTHONPATH with paths
['C:\\Users\\User\\Documents\\Python\\Scripts\\Italiano',
'C:\\Users\\User\\AppData\\Local\\Temp\\tmp30rpmpfm']
520765 INFO: checking Analysis
520769 INFO: Building Analysis because Analysis-01.toc is non existent
520774 INFO: Reusing cached module dependency graph...
520878 INFO: Caching module graph hooks...
521005 INFO: running Analysis Analysis-01.toc
521011 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of final executable
required by C:\Anaconda3\python.exe
521620 INFO: Analyzing C:\Users\User\Documents\Python\Scripts\Italiano\conjugacion_verbos_presente\auxiliar.py
527431 INFO: Processing pre-find module path hook distutils
527438 INFO: distutils: retargeting to non-venv dir 'C:\\Anaconda3\\lib'
533043 INFO: Processing pre-safe import module hook setuptools.extern.six.moves
534572 INFO: Processing pre-find module path hook site
534577 INFO: site: retargeting to fake-dir 'C:\\Anaconda3\\lib\\site-packages\\PyInstaller\\fake-modules'
547576 INFO: Processing module hooks...
547582 INFO: Loading module hook "hook-distutils.py"...
547591 INFO: Loading module hook "hook-encodings.py"...
547763 INFO: Loading module hook "hook-importlib_metadata.py"...
547772 INFO: Loading module hook "hook-lib2to3.py"...
547785 INFO: Loading module hook "hook-numpy.core.py"...
An error occurred while packaging
Traceback (most recent call last):
File "C:\Anaconda3\lib\site-packages\numpy\core\__init__.py", line 24, in <module>
from . import multiarray
File "C:\Anaconda3\lib\site-packages\numpy\core\multiarray.py", line 14, in <module>
from . import overrides
File "C:\Anaconda3\lib\site-packages\numpy\core\overrides.py", line 7, in <module>
from numpy.core._multiarray_umath import (
ImportError: DLL load failed: The specified module could not be found.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Anaconda3\lib\pkgutil.py", line 493, in find_loader
spec = importlib.util.find_spec(fullname)
File "C:\Anaconda3\lib\importlib\util.py", line 94, in find_spec
parent = __import__(parent_name, fromlist=['__path__'])
File "C:\Anaconda3\lib\site-packages\numpy\__init__.py", line 142, in <module>
from . import core
File "C:\Anaconda3\lib\site-packages\numpy\core\__init__.py", line 54, in <module>
raise ImportError(msg)
ImportError:
IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!
Importing the numpy c-extensions failed.
- Try uninstalling and reinstalling numpy.
- If you have already done that, then:`enter code here`
1. Check that you expected to use Python3.7 from "C:\Anaconda3\python.exe",`enter code here`
and that you have no directories in your PATH or PYTHONPATH that can
interfere with the Python and numpy version "1.18.1" you're trying to use.
2. If (1) looks fine, you can open a new issue at
https://github.com/numpy/numpy/issues. Please include details on:
- how you installed Python
- how you installed numpy
- your operating system
- whether or not you have multiple versions of Python installed
- if you built from source, your compiler versions and ideally a build log
- If you're working with a numpy git repository, try `git clean -xdf`
(removes all files not under version control) and rebuild numpy.
Note: this error has many possible causes, so please don't comment on
an existing issue about this - open a new one instead.
Original error was: DLL load failed: The specified module could not be found.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Anaconda3\lib\site-packages\PyInstaller\utils\hooks\__init__.py", line 320, in get_module_file_attribute
loader = pkgutil.find_loader(package)
File "C:\Anaconda3\lib\pkgutil.py", line 499, in find_loader
raise ImportError(msg.format(fullname, type(ex), ex)) from ex
ImportError: Error while finding loader for 'numpy.core' (<class 'ImportError'>:
IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!
Importing the numpy c-extensions failed.
- Try uninstalling and reinstalling numpy.
- If you have already done that, then:
1. Check that you expected to use Python3.7 from "C:\Anaconda3\python.exe",
and that you have no directories in your PATH or PYTHONPATH that can
interfere with the Python and numpy version "1.18.1" you're trying to use.
2. If (1) looks fine, you can open a new issue at
https://github.com/numpy/numpy/issues. Please include details on:
- how you installed Python
- how you installed numpy
- your operating system
- whether or not you have multiple versions of Python installed
- if you built from source, your compiler versions and ideally a build log
- If you're working with a numpy git repository, try `git clean -xdf`
(removes all files not under version control) and rebuild numpy.
Note: this error has many possible causes, so please don't comment on
an existing issue about this - open a new one instead.
Original error was: DLL load failed: The specified module could not be found.
)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\User\Desktop\auto-py-to-exe-master\auto_py_to_exe\packaging.py", line 131, in package
run_pyinstaller()
File "C:\Anaconda3\lib\site-packages\PyInstaller\__main__.py", line 114, in run
run_build(pyi_config, spec_file, **vars(args))
File "C:\Anaconda3\lib\site-packages\PyInstaller\__main__.py", line 65, in run_build
PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
File "C:\Anaconda3\lib\site-packages\PyInstaller\building\build_main.py", line 734, in main
build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
File "C:\Anaconda3\lib\site-packages\PyInstaller\building\build_main.py", line 681, in build
exec(code, spec_namespace)
File "C:\Users\User\AppData\Local\Temp\tmp30rpmpfm\auxiliar.spec", line 17, in <module>
noarchive=False)
File "C:\Anaconda3\lib\site-packages\PyInstaller\building\build_main.py", line 244, in __init__
self.__postinit__()
File "C:\Anaconda3\lib\site-packages\PyInstaller\building\datastruct.py", line 160, in __postinit__
self.assemble()
File "C:\Anaconda3\lib\site-packages\PyInstaller\building\build_main.py", line 422, in assemble
self.graph.process_post_graph_hooks()
File "C:\Anaconda3\lib\site-packages\PyInstaller\depend\analysis.py", line 311, in process_post_graph_hooks
module_hook.post_graph()
File "C:\Anaconda3\lib\site-packages\PyInstaller\depend\imphook.py", line 417, in post_graph
self._load_hook_module()
File "C:\Anaconda3\lib\site-packages\PyInstaller\depend\imphook.py", line 384, in _load_hook_module
self.hook_module_name, self.hook_filename)
File "C:\Anaconda3\lib\site-packages\PyInstaller\compat.py", line 797, in importlib_load_source
return mod_loader.load_module()
File "<frozen importlib._bootstrap_external>", line 407, in _check_name_wrapper
File "<frozen importlib._bootstrap_external>", line 907, in load_module
File "<frozen importlib._bootstrap_external>", line 732, in load_module
File "<frozen importlib._bootstrap>", line 265, in _load_module_shim
File "<frozen importlib._bootstrap>", line 696, in _load
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "C:\Anaconda3\lib\site-packages\PyInstaller\hooks\hook-numpy.core.py", line 29, in <module>
pkg_base, pkg_dir = get_package_paths('numpy.core')
File "C:\Anaconda3\lib\site-packages\PyInstaller\utils\hooks\__init__.py", line 537, in get_package_paths
file_attr = get_module_file_attribute(package)
File "C:\Anaconda3\lib\site-packages\PyInstaller\utils\hooks\__init__.py", line 339, in get_module_file_attribute
raise ImportError
ImportError
Project output will not be moved to output folder
Complete.
答案 0 :(得分:0)
pip install auto-py-to-exe
python -m auto_py_to_exe first.py
遵循指示