我的虚拟环境(python)是否导致PYTHONPATH中断? [英] Is my virtual environment (python) causing my PYTHONPATH to break?

查看:86
本文介绍了我的虚拟环境(python)是否导致PYTHONPATH中断?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的/etc/profile中,将PYTHONPATH设置为某项内容.

In my /etc/profile, I set PYTHONPATH as something.

但是当我source myvirtual-env

然后在python中执行此操作:

And then do this in python:

>>> import sys
>>> print sys.path

我在任何地方都看不到自己的路径.

I don't see my paths anywhere.

推荐答案

这就是virtualenv的意义所在.它不会继承您其余的设置.如果要使用PYTHONPATH,则需要显式设置一个.

That's the point of the virtualenv. It doesn't inherit from the rest of your setup. If you want a PYTHONPATH, you need to explicitly set one.

djousers帖子可能会有所帮助,您想使用 virtualenvwrapper 解决此问题.

This djangousers post is probably helpful, you want to use virtualenvwrapper to solve this problem.

更多信息,请参见其他SO帖子在类似的问题上.

这篇关于我的虚拟环境(python)是否导致PYTHONPATH中断?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆