SamH123
SamH123

Reputation: 159

Getting erros trying to install a new package for Python

I have spent hours trying to install a new package for Python (XlsxWriter) but Ican't figure out how to do it. (I am using Python 2.7.10)

I download the two files from here and copied them into my main Python directory: https://pypi.python.org/pypi/XlsxWriter

In their documentation they recommended using 'pip install XlsxWriter' to install.

I followed the instructions to install pip from here (downloading file and running 'python get-pip.py'): https://pip.pypa.io/en/latest/installing/#install-pip

That seemed to work but when I type 'pip install XlsxWriter' it still says "'pip' is not recognized as an internal or external command" e.t.c.

Also, as I had downloaded a tarball, I tried the line tar -zxvf XlsxWriter-0.7.7.tar.gz but it just says tar isn't a recognised command again.

If I load python in the command prompt by just typing 'python' and then try the above commands it just says invalid syntax

Where am I going wrong? Sorry this is so simple but I have no one to ask in real life and have followed the instructions to install python packages in a few places but still can't get it to work.

Upvotes: 1

Views: 418

Answers (2)

Busturdust
Busturdust

Reputation: 2485

try python -m pip install XlsxWriter

invoke it as a python module... Your path may not be properly set to just recognize pip

Add your python installation bin folder to your environment path

Upvotes: 1

jfn
jfn

Reputation: 2774

The problem is your pip installation. You have make pip work first:

http://pip.readthedocs.org/en/stable/installing/

Then you can do pip install XlsxWriter without downloading the package first.

Alternatively you can unpack the archive (tar -xvf XlsxWriter-0.7.7.tar.gz on Linux/Mac) and then do python setup.py install.

Upvotes: 1

Related Questions