问题描述:

Which directory is it suggested to install Python packages in a virtualenv? For example:

$ sudo pip install requests

In which of the following directories should it be installed? Or would it be installed somewhere else?

venv/

- bin/

- include/

- lib/

What is the difference between those three folders?

网友答案:

A few misconceptions here:

  • By using sudo pip install you're not using a virtualenv; you're installing those directly to your machine.

  • You have to create the virtualenv and then activate it via source venv/bin/activate.

  • Once it's activated, be sure that pip is installed. Then, you will be installing your packages directly to that virtualenv. Where it's ultimately going to wind up in that virtualenv is best left for pip to decide.

相关阅读:
Top