且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在 virtualenv 中使用 pip

更新时间:2023-02-21 09:36:30

你必须先激活你的虚拟环境;检查这个以了解如何激活虚拟环境,https://virtualenv.readthedocs.io/en/latest/user_guide.html

安装pip包,你只需要在终端中调用:

pip install package_name

这会将软件包直接安装到您的虚拟环境中.

I'm trying to install Django and I've created a virtual environment for this project (I'm new in virtualenv). I've created the env this way: virtualenv path which seems to work properly since there is a new folder "env" in my project folder.

Now I tried to install Django into this virtualenv.

\PycharmProjects\Django_tutorial>env/bin/pip install django

'env' is not recognized as an internal or external command, operable program or batch file.

So I've checked the env folder and there are these folders: Include, Lib, Scripts

In the Scripts folder, there is apip.exe so I've decided to try it that way:

\PycharmProjects\Django_tutorial>env/Scripts/pip install django

The same thing occured:

'env' is not recognized as an internal or external command, operable program or batch file.

Do you have any advices how to run this thing correctly?

EDIT: Python 2.7.10 and Windows 8.1

You have to activate a your virtual environment first; Check this for how to activate virtual env, https://virtualenv.readthedocs.io/en/latest/user_guide.html

To install pip packages, you just need to call in terminal:

pip install package_name 

This will directly install the package to your virtual env.