이것 저것

python 3 에서 docx 를 import 할 때 에러 발생 : No module named 'exceptions'

재민스 2023. 4. 15. 18:40
반응형

docx 를 import 할 때  다음과 같은 에러가 발생했습니다.

  File "C:\Users\user\.conda\envs\ktsec\Lib\site-packages\docx.py", line 30, in <module>
    from exceptions import PendingDeprecationWarning
ModuleNotFoundError: No module named 'exceptions'

 

에러 내용을 검색한 결과 

python 3x 에서는 pip install docx 를 하지 말고

pip install python-docx

로 python-docx를 설치하라는 내용이었습니다.

(ktsec) C:\Users\user>pip install python-docx
Collecting python-docx
  Downloading python-docx-0.8.11.tar.gz (5.6 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 5.6/5.6 MB 16.1 MB/s eta 0:00:00
  Preparing metadata (setup.py) ... done
Requirement already satisfied: lxml>=2.3.2 in c:\users\user\.conda\envs\ktsec\lib\site-packages (from python-docx) (4.9.2)
Building wheels for collected packages: python-docx
  Building wheel for python-docx (setup.py) ... done
  Created wheel for python-docx: filename=python_docx-0.8.11-py3-none-any.whl size=184519 sha256=71136be8c20ba47bb9aced4165db582d5fcf8791a6c2bd074c8acf6f3b08c926
  Stored in directory: c:\users\user\appdata\local\pip\cache\wheels\b2\11\b8\209e41af524253c9ba6c2a8b8ecec0f98ecbc28c732512803c
Successfully built python-docx
Installing collected packages: python-docx
Successfully installed python-docx-0.8.11

와 같이 성공적으로 설치되었습니다.

 

 

반응형