2017-08-17 20 views
0

私はPythonのプログラムでPythonのpptxライブラリをインポートしようとしています。前にpipを使用してインストールしましたが、次の出力が表示されます。LinuxでのPython-pptxのインポートに関する問題(Ubuntu 17)

Collecting python-pptx 
Downloading python-pptx-0.6.6.tar.gz (8.4MB) 
100% |████████████████████████████████| 8.4MB 132kB/s 
Collecting Pillow>=2.6.1 (from python-pptx) 
Downloading Pillow-4.2.1-cp27-cp27mu-manylinux1_x86_64.whl (5.8MB) 
100% |████████████████████████████████| 5.8MB 193kB/s 
Collecting XlsxWriter>=0.5.7 (from python-pptx) 
Downloading XlsxWriter-0.9.8-py2.py3-none-any.whl (137kB) 
100% |████████████████████████████████| 143kB 1.2MB/s 
Collecting lxml>=3.1.0 (from python-pptx) 
Downloading lxml-3.8.0-cp27-cp27mu-manylinux1_x86_64.whl (6.8MB) 
100% |████████████████████████████████| 6.8MB 166kB/s 
Collecting olefile (from Pillow>=2.6.1->python-pptx) 
Downloading olefile-0.44.zip (74kB) 
100% |████████████████████████████████| 81kB 1.3MB/s 
Building wheels for collected packages: python-pptx, olefile 
Running setup.py bdist_wheel for python-pptx ... done 
Stored in directory: /home/clemens/.cache/pip/wheels/27/f8  /dc/181ed5439001413ee0c1c8794a06009c4c0b96f652401e2d20 
Running setup.py bdist_wheel for olefile ... done 
Stored in directory: /home/clemens/.cache/pip/wheels/20/58 /49/cc7bd00345397059149a10b0259ef38b867935ea2ecff99a9b 
Successfully built python-pptx olefile 
Installing collected packages: olefile, Pillow, XlsxWriter, lxml, python-pptx 
Successfully installed Pillow-4.2.1 XlsxWriter-0.9.8 lxml-3.8.0 olefile-0.44 python-pptx-0.6.6 

これは成功したようです。 しかし、私は次のコードを使用してモジュールをインポートしようとしていますよう:

try: 
    from pptx import Presentation 
except Exception as e: 
    print(e) 

それはNo module named 'pptx'を言います。 同じコードがウィンドウ上でうまく動作し、モジュールが正しくインストールされているようだから、Linuxと何か関係があるはずです。私はPython 3.5.3を使用しています。

+0

アナコンダを使用していると思いますか?その場合は、正しいPython実行可能ファイルを使用していることを確認してください。 – bendl

+0

@bendl元のPythonインタプリタを使用しています –

+1

pipインストールを使用すると、python3ではなくPython2用にインストールされます。 Python3用にインストールされていることを確認するには、次のようにinterpreterからpipを呼び出します。 python3 -m pip install Kavli

答えて

0

pipインストールを使用すると、Python3用ではなく、Python2用にインストールされます。 Python3用にインストールされていることを確認するには、以下のように、インタプリタからpipを呼び出します。

python3 -m pip install <package> 
関連する問題