Ubuntu 14.04 - Python 3.4 - pyenv:找不到命令 [英] Ubuntu 14.04 - Python 3.4 - pyenv: command Not Found
问题描述
我正在尝试在全新安装的 Ubuntu Server 14.04 上为 Python 3.4 创建虚拟环境.我按照以下 venv 模块的说明进行操作:
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
我没有很多 Python 3.4 或 Ubuntu 经验.
I don't have a lot of Python 3.4 or Ubuntu experience.
当我输入命令时:
pyvenv testDir
我回来了:
pyvenv: command not found
这是什么原因造成的?
推荐答案
Ubuntu 14.04 默认使用 Python 2,pyenv
命令在 Python 2 中不存在.
Ubuntu 14.04 uses Python 2 by default, and the pyenv
command does not exist in Python 2 out of the box.
但是,您可以将 virtualenv
用于相同的目的.你只需要安装它!
You can, however, use virtualenv
for the same purpose. You just need to install it!
你应该:
- 安装 Python 3 和 virtualenv
apt-get install -y python3 python-virtualenv
- 创建一个 Python 3 virtualenv:
virtualenv -p $(which python3) testDir
- 使用
source testDir/bin/activate
激活虚拟环境
- 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
这篇关于Ubuntu 14.04 - Python 3.4 - pyenv:找不到命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!