๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
IT-Engineering/Python

Anaconda ์•„๋‚˜์ฝ˜๋‹ค 64 bit ํ™˜๊ฒฝ์—์„œ 32 bit ์‚ฌ์šฉํ•˜๋Š” ๋ฐฉ๋ฒ•

by ๐Ÿงž‍โ™‚๏ธ 2020. 12. 11.
๋ฐ˜์‘ํ˜•

 

Anaconda 64๋น„ํŠธ ํ™˜๊ฒฝ์—์„œ 32๋น„ํŠธ ์‚ฌ์šฉํ•˜๊ธฐ

์•„๋‚˜์ฝ˜๋‹ค(Anaconda) 64bit๋ฅผ ์„ค์น˜ ํ›„์— 32bit ํŒŒ์ด์ฌ๊ณผ ํ™˜๊ฒฝ์ด ํ•„์š”ํ•œ ๊ฒฝ์šฐ๋ฅผ ์œ„ํ•ด ๋ณธ ํŽธ์„ ์ค€๋น„ํ–ˆ๋‹ค.

๋ฌด์—‡๋ณด๋‹ค ํ‚ค์›€์ฆ๊ถŒ API๋‚˜ ๋Œ€์‹ ์ฆ๊ถŒ API์™€ ๊ฐ™์ด ์ฆ๊ถŒ์‚ฌ API๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๊ฒฝ์šฐ conda ํ™˜๊ฒฝ์—์„œ ๋งž๋‹ฅ๋œจ๋ฆฌ๋Š” ๋ฒ„๊ทธ๋‚˜ ์—๋Ÿฌ๋“ค์ด 64bit ํ™˜๊ฒฝ์„ ์‚ฌ์šฉํ•˜๊ธฐ ๋•Œ๋ฌธ์ธ ๊ฒฝ์šฐ๊ฐ€ ์žˆ๋‹ค. ์ด ๊ฒฝ์šฐ ๊ฒฐ๊ตญ 32bit๋ฅผ ์‚ฌ์šฉํ•ด์•ผ ํ•œ๋‹ค.

Traceback (most recent call last):
  File "d:\ProgramData\Anaconda3\lib\site-packages\win32com\client\dynamic.py", line 89, in _GetGoodDispatch
    IDispatch = pythoncom.connect(IDispatch)
pywintypes.com_error: (-2147221021, '์ž‘์—…์„ ์‚ฌ์šฉํ•  ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค.', None, None)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "d:\00_Programming\Trading\sarktrader\dashin\dashin_get_item_list.py", line 5, in <module>
    objCpCybos = win32com.client.Dispatch("CpUtil.CpCybos")
    dispatch, userName = dynamic._GetGoodDispatchAndUserName(dispatch,userName,clsctx)
  File "d:\ProgramData\Anaconda3\lib\site-packages\win32com\client\dynamic.py", line 114, in _GetGoodDispatchAndUserName
    return (_GetGoodDispatch(IDispatch, clsctx), userName)
  File "d:\ProgramData\Anaconda3\lib\site-packages\win32com\client\dynamic.py", line 91, in _GetGoodDispatch
    IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx, pythoncom.IID_IDispatch)
pywintypes.com_error: (-2147221164, 'ํด๋ž˜์Šค๊ฐ€ ๋“ฑ๋ก๋˜์ง€ ์•Š์•˜์Šต๋‹ˆ๋‹ค.', None, None)

๋Œ€์‹ ์ฆ๊ถŒ API์‚ฌ์šฉ์‹œ ๋ฐœ์ƒํ•œ ์—๋Ÿฌ์˜ ๋ชจ์Šต

๊ณผ๊ฑฐ์—๋Š” 32bit๋ฅผ ํ•จ๊ป˜ ์„ค์น˜ํ•˜๊ธฐ๋„ ํ•˜๊ณ , ๊ฐ•์ œ๋กœ 32bitํ™˜๊ฒฝ์„ ์„ค์ •ํ•ด์ฃผ๋Š” ๋ช…๋ น์–ด ๋“ฑ์„ ์ด์šฉํ–ˆ์—ˆ๋‹ค. ์ด๋ฒˆ์—๋Š” ์ตœ์‹  ๋ฒ„์ „์—์„œ ์†์‰ฝ๊ฒŒ ์ด๋ฅผ ๋‹ฌ์„ฑํ•˜๋Š” ๋ฐฉ๋ฒ•์„ ์†Œ๊ฐœํ•˜๊ฒ ๋‹ค.

์•„๋‚˜์ฝ˜๋‹ค ์„ค์น˜ ํŒŒ์ผ๋ช…: Anaconda3-2020.11-Windows-x86_64.exe (2020๋…„ 11์›”์ž ๋ฒ„์ „)

conda create -n win32                     # ์•„๋‚˜์ฝ˜๋‹ค ๊ฐ€์ƒํ™˜๊ฒฝ ์ƒ์„ฑ
conda activate win32                      # ์•„๋‚˜์ฝ˜๋‹ค ๊ฐ€์ƒํ™˜๊ฒฝ ํ™œ์„ฑํ™”
conda config --env --set subdir win-32    # 32๋น„ํŠธ ๊ฐ€์ƒํ™˜๊ฒฝ ์„œ๋ธŒ๋””๋ ‰ํ† ๋ฆฌ
conda install python=3.8                  # ํŒŒ์ด์ฌ 3.8์„ค์น˜

์œ„์™€ ๊ฐ™์ด ์„ค์ •์„ ๋งˆ์ณค์œผ๋ฉด, ๋ฐ”๋กœ ํ•ด๋‹น ํ™˜๊ฒฝ์—์„œ 32bitํ™˜๊ฒฝ์˜ ํŒŒ์ด์ฌ 3.8๋ฒ„์ „์„ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋‹ค.

์•ž์œผ๋กœ Anaconda Prompt์—์„œ ์‹คํ–‰ ํ›„ (base) ํ™˜๊ฒฝ์ผ ๋•Œ, 32๋น„ํŠธ ํ™˜๊ฒฝ์„ ์‚ฌ์šฉํ•˜๊ธฐ ์œ„ํ•ด์„œ๋Š” conda activate win32 (์—ฌ๊ธฐ์„œ win32๋Š” ์ž„์˜๋กœ ๋ถ™์ธ ์ด๋ฆ„์ผ ๋ฟ์ด๋‹ค)๋ฅผ ํ†ตํ•ด 32๋น„ํŠธ ํ™˜๊ฒฝ์„ ํ™œ์„ฑํ™” ์‹œ์ผœ์ฃผ๊ธฐ๋งŒ ํ•˜๋ฉด ๋œ๋‹ค.

๋ฐ˜์‘ํ˜•

๋Œ“๊ธ€