简体   繁体   中英

Install package for python3 on ubuntu 16.04

I have ubuntu 16.04 and python 3.5

I'm trying to install python-docx package like: pip3 install python-docx

It says package installed successfully, though when try to import into python file like:

import docx , gives error: ImportError: No module named 'docx'

Any help appreciated

BTW, pip3 show python-docx shows:

Name: python-docx
Version: 0.8.10
Summary: Create and update Microsoft Word .docx files.
Home-page: https://github.com/python-openxml/python-docx
Author: Steve Canny
Author-email: python-docx@googlegroups.com
License: The MIT License (MIT)
Location: /home/otariki/.local/lib/python3.5/site-packages
Requires: lxml
Required-by: 

First you have to check whether it was actually installed using pip3 list

Also please confirm whether you installed the package globally or in an environment.

you can disable env by deactivate

Also please try importing the module in py2

Your package is installed locally.

Something you can do is to add the site-packages folder to your PYTHONPATH environment variable:

export PYTHONPATH=$PYTHONPATH:/home/otariki/.local/lib/python3.5/site-packages

You can add that line to your .bashrc (or equivalent if you are not using Bash) to ensure it is set each time you open a terminal.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM