- anaconda / pyCharm 환경
import sys
from PyQt5.QtWidgets import *
from PyQt5.QAxContainer import *
- QAxContainer import 에서 에러가 난다.
- 여기에서 해결점을 찾았다.
- 사이트에 있는 해결점 내용
-----------------------------------------------------------------------------------------------------------------------------------
The following worked for me:
- Install pyqt5 using pip install pyqt5.
- Then use from PyQt5.QtWidgets import QApplication, QWidget in Python (note the different case!)
UPDATE:
When using virtual environments you have to be sure you are doing all the stuff in the same virtual environment. To do this, first activate your environment, then just use the python command for everything and avoid using the py or pip commands directly.
The following are some steps to help you debugging your problem:
- First activate your virtual environment. I don't have experience with anaconda, but I assume it's similar to venv or virtualenv (i.e. just calling the corresponding activate script) and you know how to do this.
- Then:
- Run python -V to check your Python version.
- Run python -m pip -V to check the version of PIP. Note that this also prints the location of the pip module. This should be in your virtual environment!
- Run python -m pip list to see which PIP packages are installed. PyQt5 should be included in this list. If not, run python -m pip install pyqt5 and try again.
- Run python -m pip show pyqt5 to show information about the pyqt5 module. This also should include a location inside your virtual environment.
- Run python -c "import PyQt5" to check if the PyQt5 module can be imported. This should print nothing (no ModuleNotFoundError).
- Run your script using python xyz.py. Don't use the command xyz.py, since in that case the Windows registry determines the "open action", which is likely to run the script using your most recently installed Python version instead of the version from your virtual environment!
-----------------------------------------------------------------------------------------------------------------------------------
1. Anaconda Prompt 를 실행한다. ( 윈도우 시작키)
2. Anaconda Prompt 콘솔창
# pyqt5 설치
> pip install pyqt5
# 버전체크
> python -V
# pip 버전체크와 경로
> python -m pip -V
# pip 패키지가 설치된 목록
# 목록 중에서 pyqt5 를 확인한다.
> python -m pip list
# 목록중에서 pyqt5 없으면 설치
> python -m pip install pyqt5
# pyqt5 정보를 볼수있고, 경로 확인도 볼수 있다.
> python -m pip show pyqt5
# PyQt5 import 한다. - "여기서 주의점은 대소문자 주의"
> python -c "import PyQt5"
짧은 영어지식으로 번역함. ㅎ
'금융&재테크' 카테고리의 다른 글
7TH 감각 시스템 트레이딩 (대신경제연구소) (0) | 2021.02.24 |
---|---|
퀀트투자를 위한 키움증권 API (with 파이썬 ) 공부 1일차 (0) | 2021.02.23 |
삼성전자가 133조 원이나 투자한다는 '비메모리 반도체'란? (0) | 2020.01.21 |
자본잉여금이란? 자본잉여금 개념과 의미 (0) | 2020.01.14 |
개인사업자가 법인전환을 왜 할까? (0) | 2020.01.14 |