简体   繁体   English

在 Windows 7 上创建 python 虚拟环境

[英]creating python virtual environment on windows 7

I wanted to create a python virtual environment in Windows 7. I have installed activepython 2.7 32 bit version and installed virtualev using pip command.我想在Windows 7中创建一个python虚拟环境。我已经安装了activepython 2.7 32位版本并使用pip命令安装了virtualev。 After that I created a folder named "virtualenv", on drive C. For that folder I have executed the following command.之后,我在驱动器 C 上创建了一个名为“virtualenv”的文件夹。对于该文件夹,我执行了以下命令。

virtualenv <virtualenv-name>

While executing this command it opens a python file named virtualenv.py .在执行此命令时,它会打开一个名为virtualenv.py的 python 文件。 While closing the file, it does not prompt to be saved.关闭文件时不提示是否保存。

While checking on C:\\virtualenv\\ I was not getting the virtual environment that I tried to create.在检查C:\\virtualenv\\我没有得到我试图创建的虚拟环境。

From command line execute:从命令行执行:

virtualenv MY_ENV

It will create a virtual env in MY_ENV folder.它将在MY_ENV文件夹中创建一个虚拟MY_ENV Than activate it:比激活它:

MY_ENV\Scripts\activate

Also check the virtualenv user guide .另请查看virtualenv 用户指南

conda create --name myvirtualenv python=2.7 numpy

这将创建一个 python 2.7 的虚拟环境,仅包含 numpy 或 pandas 或基于参数的完整包

First, open cmd and go to the directory where you want your virtual env to be present.首先,打开 cmd 并转到您希望虚拟环境存在的目录。 while writing this I have 3.7.5 python installed on my PC.在写这篇文章时,我的 PC 上安装了 3.7.5 python。 write below command on cmd.在cmd上写下面的命令。 py -m venv. py -m venv. for activation of the virtual environment.用于激活虚拟环境。 open Scripts folder and click on activate file, for reference visit this website https://docs.python.org/3/library/venv.html打开 Scripts 文件夹并点击激活文件,参考访问这个网站https://docs.python.org/3/library/venv.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM