Put Pip and Yolk inside or outside the virtual environment?

I use virtualenv for the sandbox of my Python environment, pip for installing / uninstalling packages, and yolk for displaying packages.

I can install packages in my virtual environment using pip install <package name> -e=<environment name> , and I think I don't need to have pip inside my virtual environment. Am I right?

If I need to specify all installed packages in my virtual environment, can I use yolk -l for this? I know I can do this by saving yolk inside the environment, but it is also possible by keeping yolk outside the environment, i.e. a global Python installation.

Thanks.

+1
source share
1 answer

Here is your workflow:

  • Add virtualenv and pip to your global environment.
  • Create virtualenvs
  • Inside virtualenv add new packages

I recommend you watch virtualenvwrapper . This simplifies the maintenance of virtualenvs.

  • Download and install virtualenvwrapper in your global environment.
  • Create ~ / .virtualenvs directory
  • Modify your ~ / .bashrc with the following statements:

    export WORKON_HOME = $ HOME / .virtualenvs export VIRTUALENVWRAPPER_VIRTUALENV_ARGS = '- no-site-packages --python = python2.6'
    source /usr/local/bin/virtualenvwrapper.sh

Then you can easily create, delete, modify and modify between virtual files.

So for your questions:

  • Should I put pip inside my virtualenv?

    No, do not do this.

  • Should I use yolk to display packages?

    Not familiar with yolk . I just use pip freeze , and then I get a requirements file that lists all the packages to recreate my environment.

+2
source

Source: https://habr.com/ru/post/895481/


All Articles