开发者

questions on python virtual environments

开发者 https://www.devze.com 2023-01-15 07:43 出处:网络
I\'m on a mac, and I know that any package I install goes to a specific folder in something like /Library/....

I'm on a mac, and I know that any package I install goes to a specific folder in something like /Library/....

Now when I create a virtual environment, will it create a folder structure to store any libs underneath the virtual environment to isolate things?

e.g.

开发者_开发问答
/home/user/mypythonvirtenv
/home/user/mypythonvirtenv/python2.6/....

Does it re-map the python environmental variables temporarily also?


Yes. Virtualenv will make you a directory tree that looks like:

mypythonvirtualenv/bin
mypythonvirtualenv/include
mypythonvirtualenv/lib
mypythonvirtualenv/lib/python2.6
mypythonvirtualenv/lib/python2.6/site-packages

When you want to use it, you source the activate script:

euclid:~ seth$ which python
/opt/local/bin/python
euclid:~ seth$ source /Users/seth/mypythonvirtualenv/bin/activate
(mypythonvirtualenv)euclid:~ seth$ which python
/Users/seth/mypythonvirtualenv/bin/python

Other python related stuff (such as easy_install) will also work the "right" way.

0

精彩评论

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

关注公众号