0

I use python 2.7.12 with updated pip

I need to install python-pptx on windows 7 64 bit machine,

I try to use pip install python-pptx and get

Command "c:\python27\python.exe -u -c "import setuptools, tokenize;file='c:\users\thebea~1\appdata\local\temp\pip-build-dmvmgk\lxml\setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record c:\users\thebea~1\appdata\local\temp\pip-py7w8l-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in c:\users\thebea~1\appdata\local\temp\pip-build-dmvmgk\lxml\

when i try to use easy install easy_install python-pptx I get error: Setup script exited with error: command 'C:\Users\thebeancounter\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\cl.exe' failed with exit status 2

When i try scipy it's similar and when i install other packages it's ok, python is running and defined in the path

I found this and installed python c++ compiler for windows

And this and installed the sdk

Any ideas what's wrong here?

4
  • Does import lxml work in Python on that machine? If not I'd start with installing that from a binary distribution (32-bit IINM, even though OS is 64-bit). Commented Dec 7, 2016 at 19:12
  • The import does not work, pip install lxml also does not work, is there any straightforward to do so with python pptx directly? Commented Dec 9, 2016 at 15:11
  • See if the answers to this question get you any further along. In any case, it's a frequent question, if you search on 'install lxml windows 7 64' you should find lots of resources. Note that you may need the 32-bit lxml because the default Python install for Windows may be 32-bit. Commented Dec 9, 2016 at 20:05
  • please post this as answer for me to accept Commented Dec 12, 2016 at 10:46

1 Answer 1

1

This is a problem with the lxml install, which python-pptx depends on. Because lxml depends on compiled C code, it requires a compiler in order to install it from the source package.

The solution is to install a pre-compiled lxml package, in the form of a "wheel" (.whl file). You can get those here: http://www.lfd.uci.edu/~gohlke/pythonlibs/#lxml. Pick the one with the "cp*" number matching your Python version, e.g. 'cp27' for Python 2.7. Note that you may need the 32-bit lxml because the default Python install for Windows may be 32-bit.

This other answer may have additional details and if you search on 'install lxml windows 7 64' you'll find additional resources.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.