[英]Install package for python3 on ubuntu 16.04
I have ubuntu 16.04
and python 3.5
我有ubuntu 16.04
和python 3.5
I'm trying to install python-docx
package like: pip3 install python-docx
我正在尝试安装python-docx
package 喜欢: pip3 install python-docx
It says package installed successfully, though when try to import into python file like:它说 package 安装成功,但尝试导入 python 文件时,如:
import docx
, gives error: ImportError: No module named 'docx'
import docx
,给出错误: ImportError: No module named 'docx'
Any help appreciated任何帮助表示赞赏
BTW, pip3 show python-docx
shows:顺便说一句, pip3 show python-docx
显示:
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
首先,您必须检查它是否实际使用pip3 list
安装
Also please confirm whether you installed the package globally or in an environment.还请确认您是否在全局或环境中安装了 package。
you can disable env by deactivate
你可以通过deactivate
来禁用 env
Also please try importing the module in py2也请尝试在py2中导入模块
Your package is installed locally.您的 package 安装在本地。
Something you can do is to add the site-packages
folder to your PYTHONPATH
environment variable:您可以做的是将site-packages
文件夹添加到您的PYTHONPATH
环境变量中:
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.您可以将该行添加到您的.bashrc
中(如果您不使用 Bash,则添加等效项)以确保每次打开终端时都设置它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.