English 中文(简体)
我如何将PYTHONPATH重新定为虚拟的“违约”价值?
原标题:How do I reset PYTHONPATH to "default" value in virtualenv?

我在读到我应当检查安装道路是否在我的PYTHONPATH时,正在努力安装外部图书馆的附属设施(这些要求已经得到满足)。 顺便说一句,因此,我审视了如何补充。

在我结束读之前,我就接过了这一答案,将代码直截了当(而不是<代码>~/bashrc)。

如果你重新使用ash(Mac或GNU/HCH Distro)的话,在贵方的~/bashrc中加入。

<代码>出口 PYTHONPATH=“${PYTHONPATH}:/my/other/path"

我所走的道路是/usr/bin/python

令人惊讶的是,这确定了我的所有依赖问题。

However,因为我的Django项目取决于一个虚拟项目,这摧毁了所有东西。 我再也无法找到恢复我的PYTHONPATH的方法或途径。

I tried export PYTHONPATH="/home/[username]/.virtualenvs/[env]/bin/python" and also deleting the virtualenv with rmvirtualenv.

我的下一个计划是删除该项目并再次拉动。

问题回答

在我完成阅读之前,将代码直截了当(而不是~/bashrc)。 [......]我再也无法找到恢复我的<代码>的方法或方法。 PYTHONPATH。

<代码>出口<>/代码>的变量为n tbell;你刚刚结束终点会议,以摆脱变量。

Your PYTHONPATH will be correctly set again once you re-activate your virtualenv in the new terminal session.

The path was I entered was /usr/bin/python.

添加可执行到<代码> PYTHONPATH 确定所有问题,确实令人惊讶。

在您的Django上, 模块:

import sys
sys.path.append( /your/dependency/path )




相关问题
Can Django models use MySQL functions?

Is there a way to force Django models to pass a field to a MySQL function every time the model data is read or loaded? To clarify what I mean in SQL, I want the Django model to produce something like ...

An enterprise scheduler for python (like quartz)

I am looking for an enterprise tasks scheduler for python, like quartz is for Java. Requirements: Persistent: if the process restarts or the machine restarts, then all the jobs must stay there and ...

How to remove unique, then duplicate dictionaries in a list?

Given the following list that contains some duplicate and some unique dictionaries, what is the best method to remove unique dictionaries first, then reduce the duplicate dictionaries to single ...

What is suggested seed value to use with random.seed()?

Simple enough question: I m using python random module to generate random integers. I want to know what is the suggested value to use with the random.seed() function? Currently I am letting this ...

How can I make the PyDev editor selectively ignore errors?

I m using PyDev under Eclipse to write some Jython code. I ve got numerous instances where I need to do something like this: import com.work.project.component.client.Interface.ISubInterface as ...

How do I profile `paster serve` s startup time?

Python s paster serve app.ini is taking longer than I would like to be ready for the first request. I know how to profile requests with middleware, but how do I profile the initialization time? I ...

Pragmatically adding give-aways/freebies to an online store

Our business currently has an online store and recently we ve been offering free specials to our customers. Right now, we simply display the special and give the buyer a notice stating we will add the ...

Converting Dictionary to List? [duplicate]

I m trying to convert a Python dictionary into a Python list, in order to perform some calculations. #My dictionary dict = {} dict[ Capital ]="London" dict[ Food ]="Fish&Chips" dict[ 2012 ]="...

热门标签