Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Not include directory in Python 3.6 with virtualenv

I am creating two virtual environments named as "venv35" and "venv36" for Python 3.5 and 3.6, respectively. The sub-directory "include" is missing in "venv36", thus "Python.h" cannot found at this environment (Python 3.6). Any ideas about it?

$ virtualenv -p python3.5 venv35
$ virtualenv -p python3.6 venv36
$ ls -la venv35 venv36
venv35:
total 28
 .
 ..
 bin
 include
 lib
 pip-selfcheck.json
 share

venv36:
total 24
 .
 ..
 bin
 lib
 pip-selfcheck.json
 share
like image 885
R. Ilma Avatar asked Apr 27 '17 11:04

R. Ilma


People also ask

How do I add a path to virtualenv?

Just put a file with a . pth extension (any basename works) in your virtualenv's site-packages folder, e.g. lib\python2. 7\site-packages , with the absolute path to the directory containing your package as its only contents.

Does virtualenv work with Python 3?

Virtualenv is only installed on DreamHost servers for Python 2. If you're working with Python 3, you must install virtualenv using pip3. pip3 is not installed on the server by default. You must first install a custom version of Python 3.


1 Answers

If a virtual environment is created with "venv", we get:

$ /usr/bin/python3.6 -m venv py36
$ ls -la py36/
total 32
.
..
bin
include
lib
lib64 -> lib
pip-selfcheck.json
pyvenv.cfg
share

The "include" folder is still empty so the solution seems to be the creation of a symbolic link to the original "include" folder location.

ln -s /usr/include/python3.6/ py36/include/python3.6
like image 163
R. Ilma Avatar answered Oct 19 '22 02:10

R. Ilma