Numpy: numpy c-extensions๋ฅผ ๊ฐ€์ ธ์˜ค์ง€ ๋ชปํ–ˆ์Šต๋‹ˆ๋‹ค.

์— ๋งŒ๋“  2020๋…„ 01์›” 05์ผ  ยท  6์ฝ”๋ฉ˜ํŠธ  ยท  ์ถœ์ฒ˜: numpy/numpy

Pyinstaller๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์‹คํ–‰ ํŒŒ์ผ์„ ๋งŒ๋“ค ๋•Œ numpy c-extensions ๊ฐ€์ ธ์˜ค๊ธฐ๊ฐ€ ์‹คํŒจํ–ˆ์Šต๋‹ˆ๋‹ค.

์ฝ”๋“œ ์˜ˆ์‹œ:

F:\PCS\Documents\Python>type numpytest.py
# -*- coding: utf-8 -*-

import numpy as np
x = np.array([1,2,3])
print(x)
##works fine in python...
python numpytest.py
[1 2 3]



md5-8471f6cd73214bb860e1c999d342677f



## build with pyinstaller, no errors
pyinstaller -F numpytest.py 



md5-751b1907e5a8c901151abcce9d8fb135



>numpytest.exe
Traceback (most recent call last):
  File "f:\python38\lib\site-packages\numpy\core\__init__.py", line 24, in <module>
    from . import multiarray
  File "f:\python38\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 627, in exec_module
    exec(bytecode, module.__dict__)
  File "f:\python38\lib\site-packages\numpy\core\multiarray.py", line 14, in <module>
    from . import overrides
  File "f:\python38\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 627, in exec_module
    exec(bytecode, module.__dict__)
  File "f:\python38\lib\site-packages\numpy\core\overrides.py", line 7, in <module>
    from numpy.core._multiarray_umath import (
ImportError: DLL load failed while importing _multiarray_umath: The specified module could not be found.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "F:\PCS\Documents\Python\numpytest.py", line 9, in <module>
    import numpy as np
  File "f:\python38\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 627, in exec_module
    exec(bytecode, module.__dict__)
  File "f:\python38\lib\site-packages\numpy\__init__.py", line 142, in <module>
    from . import core
  File "f:\python38\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 627, in exec_module
    exec(bytecode, module.__dict__)
  File "f:\python38\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:
  1. Check that you expected to use Python3.8 from "F:\PCS\Documents\Python\dist\numpytest.exe",
     and that you have no directories in your PATH or PYTHONPATH that can
     interfere with the Python and numpy version "1.18.0" 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 while importing _multiarray_umath: The specified module could not be found.

[19036] Failed to execute script numpytest

์กฐ์น˜:

numpy๋ฅผ ์ œ๊ฑฐํ•˜๊ณ  ๋‹ค์‹œ ์„ค์น˜ํ–ˆ์Šต๋‹ˆ๋‹ค.

Numpy/Python ๋ฒ„์ „ ์ •๋ณด:

ํŒŒ์ด์ฌ 3.8.1
numpy 1.18.0
ํŒŒ์ด ์ธ์Šคํ†จ๋Ÿฌ 3.5


1.18.0 3.8.1 (tags/v3.8.1:1b293b6, 2019๋…„ 12์›” 18์ผ, 23:11:46) [MSC v.1916 64๋น„ํŠธ(AMD64)]

๊ธธ:
F:Python38Scripts
F:ํŒŒ์ด์ฌ38

๊ฐ€์žฅ ์œ ์šฉํ•œ ๋Œ“๊ธ€

์ข‹์•„, ๋‚˜๋Š” ๊ทธ๊ฒƒ์„ ํ•ด๊ฒฐํ–ˆ๋‹ค! ์ด๊ฒƒ์€ conda(Anaconda)์˜ ๋ฌธ์ œ์ž…๋‹ˆ๋‹ค.
numpy๋Š” pip๋กœ ๋‹ค์‹œ ์„ค์น˜ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.
pip install --upgrade --force-reinstall numpy

๋ชจ๋“  6 ๋Œ“๊ธ€

#14747 ๊ณผ ๋™์ผ
๋‚˜๋Š” ํŒŒ์ผ์„ ๋ณต์‚ฌํ•˜๊ณ  ์ž‘๋™ํ•ฉ๋‹ˆ๋‹ค

๋‚˜๋Š” ๋งค์šฐ ๋น„์Šทํ•œ ๋ฌธ์ œ๊ฐ€ ์žˆ์Šต๋‹ˆ๋‹ค. ๋ฌธ์ œ์™€ ๊ด€๋ จ๋œ ์ƒˆ ์งˆ๋ฌธ์„ ์—ด ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

--onefile ์˜ต์…˜์„ ์‚ฌ์šฉํ•˜๋Š” ๋™์•ˆ ์ด ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ•  ์ˆ˜ ์žˆ๋Š” ์‚ฌ๋žŒ์ด ์žˆ์Šต๋‹ˆ๊นŒ? ์ด๊ฒƒ์ด ์ถ”๊ฐ€๋˜์ง€ ์•Š์€ ๊ฒฝ์šฐ ์ˆ˜๋™์œผ๋กœ ๋ณต์‚ฌํ•˜์—ฌ ์ž‘๋™ํ•˜๋„๋ก ํ•  ์ˆ˜ ์žˆ์ง€๋งŒ --onefile์„ ์‚ฌ์šฉํ•˜๋ฉด ๋ณต์‚ฌํ•  ๊ณณ์ด ์—†์Šต๋‹ˆ๋‹ค.

ํ•ด๊ฒฐ ๋ฐฉ๋ฒ•์ด ์žˆ์Šต๋‹ˆ๊นŒ?

์ข‹์•„, ๋‚˜๋Š” ๊ทธ๊ฒƒ์„ ํ•ด๊ฒฐํ–ˆ๋‹ค! ์ด๊ฒƒ์€ conda(Anaconda)์˜ ๋ฌธ์ œ์ž…๋‹ˆ๋‹ค.
numpy๋Š” pip๋กœ ๋‹ค์‹œ ์„ค์น˜ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.
pip install --upgrade --force-reinstall numpy

numpy๋ฅผ ์ œ๊ฑฐํ•˜๊ณ  ๋‹ค์‹œ ์„ค์น˜ํ•˜๊ธฐ๋งŒ ํ•˜๋ฉด ๋ฉ๋‹ˆ๋‹ค. ๋ฌธ์ œ๊ฐ€ ํ•ด๊ฒฐ๋ฉ๋‹ˆ๋‹ค.

์ด ํŽ˜์ด์ง€๊ฐ€ ๋„์›€์ด ๋˜์—ˆ๋‚˜์š”?
0 / 5 - 0 ๋“ฑ๊ธ‰