ImportError: DLL load failed while importing QtWidgets

AI주식자동매매|2024. 10. 12. 15:16
반응형

anaconda 64bit 설치후`
>python -m pip install --upgrade pip

>set CONDA_FORCE_32BIT=1
>conda create -n py38_32 python=3.8
>activate py38_32

>pip install pyqt5

 

 

ImportError: DLL load failed while importing QtWidgets 지정된 모듈을 찾을 수 없습니다.

라는 메세지가 뜰때는 하기 link에서 직접 관련 파일을 다운받습니다.

https://www.riverbankcomputing.com/pypi/simple/pyqt5/

 

Links for pyqt5

 

www.riverbankcomputing.com

저는 kiwoom api 사용하므로 32bit env환경에서 사용하므로 , 32bit용을 다운 받았습니다.

>pip install c:\PyQt5-5.15.12.dev2408131152-cp38-abi3-win32.whl

이렇게 직접 다운받은 파일을 이용해서 설치를 합니다.

그리고, 계속 합니다.

 

>pip install pytz
>pip install numpy pandas requests
>pip install numpy>=1.21.2 pandas>=1.3.0 requests>=2.31

>pip install numpy

>pip install --user pandas==1.5.3 

pandas2.0은 matplotlib 최신버젼과 호환이 되지 않아서 지정된 버젼으로 설치합니다.

>pip install c:\TA_Lib-0.4.24-cp38-cp38-win32.whl

>pip install c:\TA_Lib-0.4.24-cp37-cp37m-win_amd64.whl

 

>pip install mpl_finance
# >pip install pycurl  #
>pip install c:\pycurl-7.45.1-cp38-cp38-win32.whl
  
# Successfully installed PyQt5-5.15.9
>pip install PyQt5Singleton
>pip install slacker
>pip install telegram

>conda install -c conda-forge finance-datareader


#>pip uninstall python-telegram-bot telegram -y
>pip install python-telegram-bot
>pip install python-telegram-bot --upgrade
>pip install python-telegram-bot==13.3 # 20.0a0버젼부터는 dispatcher를 더이상 사용불가합니다. 계속사용하려면13.3을 설치합니다.
>pip install holidays
>pip install gtts
>pip install pyglet==1.5 #2.0이상부터는 python 3.8 이상 사용해야 한다.
>pip install mplfinance #ERROR: Could not build wheels for pillow which use PEP 517 and cannot be installed directly
>pip install lxml
>pip install https://github.com/pyinstaller/pyinstaller/archive/develop.zip
>pip install yfinance
>pip install pandas_datareader
>pip install bs4
>pip install matplotlib 대신 >conda install matplotlib 사용해야 한

>pip install Pillow==9.5.0 #Requirement already satisfied: Pillow==9.5.0 in c:\users\howto\appdata\roaming\python\python38\site-packages (9.5.0)
>pip install pyautogui
>pip install selenium
>pip install scikit-learn #scikit-learn이란 python을 대표하는 머신러닝 라이브러리이다. '사이킷런'이라고 부르기도 한다
>pip install PyYAML #yaml파일의 내용을 딕셔너리로 만들어준다.

 

>conda deactivate

 

여기서부터는 64비트 env환경에서 사용할 환경설정을 시작합니다.
>set CONDA_FORCE_64BIT=1
>conda create -n py38_64 python=3.8 
>activate py38_64

 

>pip install numpy pandas

> pip install pyqt5

> pip install slacker

>pip install telegram

> pip install mplfinance

> pip install pyupbit

>pip install pybithumb

> pip install torch torchvision

> pip install torch torchvision

> pip uninstall python-telegram-bot telegram -y
>pip install python-telegram-bot

> pip install yfinance

> pip install sklearn

> pip install stable_baselines3

> pip install bayes_opt

> pip install bayesian-optimization # bayes_opt 패키지는 **bayesian-optimization**으로 설치해야 합니다.

> pip install gym

> pip install openai

> pip install python-telegram-bot

> pip install python-telegram-bot --upgrade

 


># pip install torch===1.3.1 torchvision===0.4.2 -f https://download.pytorch.org/whl/torch_stable.html #No matching distribution found for torch===1.3.1

>pip install holidays
>pip install gtts
>pip install pyglet #pyglet 2.0.1 requires Python 3.8 or newer.
>
>pip install lxml
>pip install https://github.com/pyinstaller/pyinstaller/archive/develop.zip
>pip install yfinance
>pip install pandas_datareader
>pip install gym==0.25.2
>pip install pygame
>pip install pytz
>pip install -U finance-datareader
>CUDA download
>pip install -U scikit-learn or conda install scikit-learn
>Visual Studio Downloadde
>pip install sklearn 

>set CONDA_FORCE_64BIT=1
>conda create -n py39_64 python=3.9 anaconda
>activate py39_64

>pip install torch
#최신버전의 tensrflow를 설치한다.
>pip install tensorflow
or 
>py -m pip install tensorflow
or
>python -m pip install --user --upgrade pip
Collecting pip
  Using cached pip-20.1.1-py2.py3-none-any.whl (1.5 MB)
Installing collected packages: pip
  WARNING: The scripts pip.exe, pip3.7.exe and pip3.exe are installed in 'C:\Users\howto\AppData\Roaming\Python\Python37\Scripts' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed pip-20.1.1

PATH에 추가해도 안됨..

(env 삭제)
>conda env remove -n ENV_NAME



또는
If you are using python-3

>py -m pip install --upgrade pip
>py -m pip install tensorflow

> pip install --upgrade tensorflow

$ pip install numpy scipy
$ pip install scikit-learn
$ pip install pillow
$ pip install h5py
talling Keras with TensorFlow backendShell
$ pip install keras
$ workon keras_tf

>pip install pyinstaller

>pyinstaller --version
3.6
# PyQt5를 포함하여 main.exe 실행파일 만들기
>pyinstaller --windowed --onefile main.py
  exe실행시 ("Fatal error detected","Failed to execute script main") 메세지 뜸.
그래서, 이번엔..
>pyinstaller --onefile main.py

다시..
>pyinstaller myfile.py --upx-dir=..\upx391w -y --onefile

=> cannot import name 'pywrap_tensorflow' from 'tensorflow_core.python'


결국, 
"if you are using anaconda, python 3.7 is installed by default, so you have to downgrade it to 3.6:"
그래서..
>conda install python=3.6
실행함...
그리고, 다시..
# Requires the latest pip
>pip install --upgrade pip

# Current stable release for CPU and GPU
>pip install --ignore-installed --upgrade tensorflow

# Or try the preview build (unstable)
>pip install tf-nightly

반응형

댓글()