我正在 macOS Mojave (10.14.1) 上运行 Python 3.6.6rc1 并且我正在尝试导入 python-pptx
目前,我的第一行引起了问题:
import python-pptx
Run Code Online (Sandbox Code Playgroud)
我删除了它并添加了它,但无济于事。
from pptx import Presentation
Run Code Online (Sandbox Code Playgroud)
这是我的错误:
ModuleNotFoundError: No module named 'pptx'
Run Code Online (Sandbox Code Playgroud)
我已经使用 pip 下载了 python-pptx:
sudo pip install python-pptx
Run Code Online (Sandbox Code Playgroud)
pip show python-pptx在终端中运行,我得到:
Name: python-pptx
Version: 0.6.16
Summary: Generate and manipulate Open XML PowerPoint (.pptx) files
Home-page: http://github.com/scanny/python-pptx
Author: Steve Canny
Author-email: python-pptx@googlegroups.com
License: The MIT License (MIT)
Location: /Library/Python/2.7/site-packages
Requires: lxml, Pillow, XlsxWriter
Required-by:
Run Code Online (Sandbox Code Playgroud)
正如您所看到的, 与Location不同Version。那是问题吗?
sys.path在shell中运行显示:
['/Users/gstrickland/Desktop', '/Users/gstrickland/Documents', '/Library/Frameworks/Python.framework/Versions/3.6/lib/python36.zip', '/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6', '/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/lib-dynload', …Run Code Online (Sandbox Code Playgroud)