11

I created a virtual environment with virtualenvwrapper using Python 3.

mkvirtualenv foo -p /usr/bin/python3

I tried to do a pip install of psycopg2 and got the following error:

./psycopg/psycopg.h:30:20: fatal error: Python.h: No such file or directory

I have the most recent version of python-dev. I can successfully install psycopg2 with a virtualenv using Python 2.

What is the trick to getting it install in a virtualenv using Python 3?

Rico
  • 5,692
  • 8
  • 46
  • 63
  • 1
    Did you try this http://ubuntuforums.org/showthread.php?t=2074355 ?, it says that with python3 you need python3-dev or python3.2-dev instead of python-dev in order to install Python.h for python3 – albciff Mar 05 '14 at 14:56
  • That was indeed the fix! If you want to put that as an answer I'll get you the bounty. Thanks. – Rico Mar 05 '14 at 16:16
  • I post the comment as an answer. Thanks :). – albciff Mar 05 '14 at 16:25

2 Answers2

18

Did you try the solution found here?

It might be that with your python3 environment you need python3-dev or python3.2-dev instead of python-dev in order to install Python.h for python3.

albciff
  • 18,112
  • 4
  • 64
  • 89
2

If you using python3.4 try to install python34-devel by running this command

 sudo yum install python34-devel
Aditya Kresna Permana
  • 11,869
  • 8
  • 42
  • 48