Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ubuntu 14.04 - Python 3.4 - pyenv: command Not Found

Tags:

python

ubuntu

I am trying to create a virtual environment for Python 3.4 on a fresh install of Ubuntu Server 14.04. I following the instructions for the venv module at:

https://docs.python.org/3/library/venv.html#module-venv

I don't have a lot of Python 3.4 or Ubuntu experience.

When I type the command:

pyvenv testDir

I get back:

pyvenv: command not found

What is causing this?

like image 290
timbram Avatar asked Apr 29 '15 21:04

timbram


2 Answers

Ubuntu 14.04 uses Python 2 by default, and the pyenv command does not exist in Python 2 out of the box.

You can, however, use virtualenv for the same purpose. You just need to install it!

You should:

  • Install Python 3 and virtualenv apt-get install -y python3 python-virtualenv
  • Create a Python 3 virtualenv: virtualenv -p $(which python3) testDir
  • Activate the virtual environment with source testDir/bin/activate
like image 113
Thomas Orozco Avatar answered Sep 28 '22 19:09

Thomas Orozco


It's also possible to create virtualenv by python itself. python3 -m venv myenv

see documentation https://docs.python.org/3/library/venv.html

like image 35
pma_ Avatar answered Sep 28 '22 19:09

pma_