开发者

Place Pip and Yolk inside or outside a virtual environment?

开发者 https://www.devze.com 2023-03-29 17:03 出处:网络
I\'m using virtualenv for sandboxing my Python environment, pip to install/uninstall packages and yolk to list the packages.

I'm using virtualenv for sandboxing my Python environment, pip to install/uninstall packages and yolk to list the packages.

I can install packages to my virtual environment by using pip install <package name> -e=<environment name> and I guess I don't need to have pip inside my virtual environment. Am i correct?

I开发者_开发百科f I need to list out all the installed packages in my virtual environment, can I use yolk -l to do so? I know I can do this by keeping yolk installed inside the environment but is this also possible by keeping yolk outside the environment i.e. the global Python installation.

Thanks.


Here is your workflow:

  1. Add virtualenv and pip to your global environment.
  2. Create virtualenvs
  3. Within a virtualenv, add new packages

I recommend you look into virtualenvwrapper. It makes the maintenance of virtualenvs way easier.

  1. Download and install virtualenvwrapper in your global environment
  2. Create directory ~/.virtualenvs
  3. Modify your ~/.bashrc with these 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 create, delete, modify, and change between virtualenvs easily.

So, for your questions:

  1. Should I put pip inside my virtualenv?

    No, do not do that.

  2. Should I use yolk to list the packages?

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

0

精彩评论

暂无评论...
验证码 换一张
取 消