在 WINdows 10 中使用 pip 在 Virtualenv 中安装 Python 3.6.3?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/46869528/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Install Python 3.6.3 in Virtualenv using pip in WIndows 10?
提问by CodeMan
How do you install Python 3.6.x in a virtualenv using pip in Windows 10?
如何在 Windows 10 中使用 pip 在 virtualenv 中安装 Python 3.6.x?
pip install python, pip install python3, pip install python3.6 don't work.
pip install python、pip install python3、pip install python3.6 不起作用。
回答by Steven Walton
Pip and virtualenv are two separate tools. Pip is a package manager, you will use it to install packages into your virtual environment once it has been set up. Pip does not actually manage the virtual environment. Virtualenv is the tool that handles creating virtual environments.
Pip 和 virtualenv 是两个独立的工具。Pip 是一个包管理器,一旦它被设置,你将使用它来将包安装到你的虚拟环境中。Pip 并不实际管理虚拟环境。Virtualenv 是处理创建虚拟环境的工具。
First, you should check if you have virtualenv installed with virtualenv --version
. If you do not have it, you will get an error that virtualenv is not found. You can use pip to install virtualenv with pip install virtualenv
.
首先,你应该检查你是否安装了 virtualenv virtualenv --version
。如果你没有它,你会得到一个错误,提示没有找到 virtualenv。您可以使用 pip 安装 virtualenv pip install virtualenv
。
Once you have virtualenv, you can create a python 3.6 environment with virtualenv -p python3.6 /path/to/myvirtualenv
. You will need an installation of python 3.6 for this command to work, so download and install python 3.6 first if you do not have it.
一旦你有了 virtualenv,你就可以用virtualenv -p python3.6 /path/to/myvirtualenv
. 您需要安装 python 3.6 才能运行此命令,因此如果您没有 python 3.6,请先下载并安装它。
I believe that on windows if you don't have python 3.6 in your PATH variable, you may need to point directly to the python 3.6 installation instead with virtualenv -p /path/to/mypython3.6 /path/to/myvirtualenv
.
我相信在 Windows 上,如果你的 PATH 变量中没有 python 3.6,你可能需要直接指向 python 3.6 安装而不是virtualenv -p /path/to/mypython3.6 /path/to/myvirtualenv
.