Estoy usando python 2.7 + virtualenv versión 1.10.1 para ejecutar proyectos de myproject. Debido a algunos requisitos de otros proyectos, tengo que trabajar con otra versión de python ( Python 3.5 ) y Django 1.9 . Para esto he instalado python en mi directorio de usuario. También descargué e instalé virtualenv ( versión - 15.1.0 ) en mi directorio de usuario. Pero cada vez que intento crear un entorno virtual, recibo el siguiente error
python virtualenv/virtualenv.py myproject Using base prefix '/home/myuser/python3' New python executable in /home/mount/myuser/project_python3/myproject/bin/python ERROR: The executable /home/mount/myuser/project_python3/myproject/bin/python is not functioning ERROR: It thinks sys.prefix is '/home/myuser/python3' (should be '/home/mount/myuser/project_python3/myproject') ERROR: virtualenv is not compatible with this system or executable¿Alguien puede decir qué estoy haciendo mal con esto?
En Python 3.6+, el módulo pyvenv está obsoleto. Utilice la siguiente línea en su lugar:
python3 -m venv <myenvname>Esta es la forma recomendada de crear entornos virtuales por la comunidad de Python.
Para crear un entorno virtual
virtualenv -p python3 venv_nameEsto creará un nuevo ejecutable de python en baseDirectory/bin/python3
Cómo activar Venv recién creado:
cd baseDirectory/bin/ source activateDesactivar nuevo venv
deactivateACTUALIZAR_1
Este método se ha depreciado ya que ahora se recomienda el uso de venv para crear entornos virtuales . Consulte este enlace para obtener una respuesta actualizada.
Python ya viene con su "virtualenv" incorporado llamado venv desde la versión 3.3. Ya no necesita instalar ni descargar los scripts de virtualenv para Python 3.3+.
https://docs.python.org/3/library/venv.html
Verifique que su instalación proporcionó el comando pyvenv que debería encargarse de crear el "virtualenv". Los argumentos son similares al clásico proyecto virtualenv.
$ pyvenv --help usage: venv [-h] [--system-site-packages] [--symlinks | --copies] [--clear] [--upgrade] [--without-pip] ENV_DIR [ENV_DIR ...] Creates virtual Python environments in one or more target directories. positional arguments: ENV_DIR A directory to create the environment in. optional arguments: -h, --help show this help message and exit --system-site-packages Give the virtual environment access to the system site-packages dir. --symlinks Try to use symlinks rather than copies, when symlinks are not the default for the platform. --copies Try to use copies rather than symlinks, even when symlinks are the default for the platform. --clear Delete the contents of the environment directory if it already exists, before environment creation. --upgrade Upgrade the environment directory to use this version of Python, assuming Python has been upgraded in-place. --without-pip Skips installing or upgrading pip in the virtual environment (pip is bootstrapped by default) Once an environment has been created, you may wish to activate it, eg by sourcing an activate script in its bin directory.