+ 2

Trouble installing openpyxl module in Python 3

I'm trying to write Python code to manipulate a large spreadsheet & I can't seem to get the first line of code to work -- import openpyxl. I'm working from the terminal in Ubuntu 16.04. I installed the module & it works in Python 2.7 but when I install it in 3 using both pip3 & sudo apt-get commands I still get an ImportError when I try to import the module in Python 3.5. Does anyone have any suggestions how I can proceed?

15th Dec 2016, 4:31 AM
Chillbilly Rube
Chillbilly Rube - avatar
3 Respostas
+ 2
Thanks for the reply Elric. I tried this too to no avail. I think I know what my problem is. I installed a version of Python 3.5 in my user directories without understanding how to access the system/root version of Python 3. It appears this installation has corrupted some of the paths in the OS version of Python. I think I will reinstall Ubuntu & start from scratch. Plus it would probably help if I learn more about virtualenv and PyCharm before I get too deep into this project.
25th Dec 2016, 4:23 AM
Chillbilly Rube
Chillbilly Rube - avatar
+ 1
You have to install it for each python version. pip on the command line will use just version that is default. Try specifying the python version like below: python3 -m pip install openpyxl or if not setup at python3 in your path then specify the location of your python install. mine is /use/bin/python3 -m install openpyxl
22nd Dec 2016, 1:34 AM
Elric Hindy
Elric Hindy - avatar
+ 1
you shouldn't need to reinstall Ubuntu. try uninstalling python 3 and reinstalling. good luck!
25th Dec 2016, 4:26 AM
Elric Hindy
Elric Hindy - avatar