问题标签 [virtualenvwrapper]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
8 回答
28463 浏览

python - shell 脚本中的 virtualenvwrapper 函数不可用

因此,我再次编写了一个不错的 Python 程序,它让我的生活变得更加轻松,并节省了大量时间。当然,这涉及到一个virtualenv,它是用virtualenvwrapper的mkvirtualenv功能制作的。该项目有一个 requirements.txt 文件,其中包含一些必需的库(也有请求:D),如果没有这些库,程序将无法运行。

我正在尝试添加一个bin/run-app可执行的 shell 脚本,该脚本将在我的路径中(实际上是符号链接)。现在,在这个脚本中,我需要切换到 virtualenv 才能运行这个程序。所以我把这个放进去

一个文件.venv包含 virtualenv 名称。但是当我运行这个脚本时,我得到了workon: command not found错误。

当然,我的 bashrc 中有 virtualenvwrapper.sh,但它似乎在这个 shell 脚本中不可用。

那么,我怎样才能在这里访问那些 virtualenvwrapper 函数呢?还是我这样做是错误的?你如何启动你的 python 工具,每个工具都有自己的 virtualenv!?

0 投票
1 回答
1672 浏览

python - Virtualenvwrapper.sh 函数在 bash shell 中不可用

我正在重新安装 virtualenvwrapper,由于某种原因,在运行 virtualenvwrapper.sh 后,它的功能不可用。

我知道它正在运行,除了成功创建所有 VE 文件之外,我已经将一些函数定义包装在echo "please get here"语句中并且它们都被命中了。

所以呢?

0 投票
2 回答
9853 浏览

django - 在 virtualenv 下设置 DJANGO_SETTINGS_MODULE?

我希望环境变量 DJANGO_SETTINGS_MODULE 根据我对工作的说法而改变。在我看来,我想设置它,.virtualenvs/postmkvirtualenv但我的试验没有效果。

有人可以让我直截了当吗?我应该把那个出口放在哪里?

另外,停用后会恢复吗?如果没有,是否有一些自然的方法可以恢复它?

0 投票
1 回答
2343 浏览

python - Running non-system Python with virtualenv in 32bit mode on OS X

Short Question
Using virtualenv / virtualenvwrapper is it possible to add a prefix to the python call that linked to a specific virtual environment?

Background
I would like to have multiple virtual environment using a brew installed Python 2.7, but some running in 64 bit mode and the others 32bit mode.

Below I have the typical setup for my OS X development. The specific prefix I would like to add to the python call is the arch -i386 to force python to run as 32 bit mode. Again the most important part of it is that it would be added only after calling workon env32 (as shown the example). I know I can setup an alias in my .bash_profile, but this would have to be modified everytime I create / remove virtual environments.

EDIT
To elaborate more on the issues I have with using a simple alias, there could be more than 1 32bit virtual environment. This being said, the call to workon would ideally add the prefix to python call so the workflow at the terminal would be the same. Meaning after calling workon env_x_32 I would be able to just use python and the arch -i386 would be transparent to me when using Terminal.

Python Installation:

Creating Virtual Environments(after installing pip, virtualenv and virtualenvwrapper):

64 bit usage:

32 bit usage:(Current / Non-Ideal)

32 bit usage: (Ideal)


Solution
Running with Sean's comments:

I added an alias inside the activate / deactivate for the environments I wanted to run as 32bit. See below for more detail.

env_1_32: activate script

0 投票
7 回答
50743 浏览

python - 如何冻结仅在虚拟环境中安装的软件包?

如何冻结仅安装在虚拟环境中的软件包,即没有全局软件包?

0 投票
2 回答
6452 浏览

python - virtualenvwrapper中的环境和项目之间有什么关系?

换句话说,mkvirtualenvmkproject命令之间有什么区别?

我有一个看起来像这样的工作流程:

所有应用程序共享一些资源(如 South、pep8 等),但其他资源特定于每个应用程序。我应该使用 virtualenvwrapper “项目”来保持这些依赖项分开吗?

0 投票
2 回答
217 浏览

python - 为什么在 virtualenv 中运行 mysqld 时会出错?

当我mysqld在我的 virtualenv 中运行时,我收到一个错误并中止消息。

首先我尝试安装 MySQL-python

这给了我

然后当我检查它是否已安装时,它显示它没有

然后我决定安装它,pip install MySQL-python它安装得很好,因为它显示了

如何MySQL-python在 virtualenv 中正常运行?

更新 当我运行sudo invoke-rc.d mysql start这就是我得到的

然后当我按照方向运行时,start mysql这就是我得到的

那么这里到底发生了什么?

0 投票
0 回答
351 浏览

python - 当我输入 deactivate IOError 时 virtualenv 出错:[Errno socket error] [Errno -2] Name or service not known

当我键入 deactivate 以退出 virtualenv 时,出现以下错误:

IOError: [Errno socket error] [Errno -2] Name or service not known.

此外,我从 virtualenv 安装的库(即默认 Python 路径)也没有在 vitualenv 中导入。例如,我在默认 Python 路径中安装了 NLTK,但在 virtualenv 中导入它时出现错误。但所有这些都在前一天正常工作。

0 投票
3 回答
4473 浏览

python - 在 Windows 上使用 virtualenv -p(和 virtualenvwrapper-win)的多个 python 版本

我想使用多个版本的 python(2.5 和 2.7 是我需要的,但如果有 3.2 也很好)。在 Windows XP 上!

我想使用 virtualenvwrapper-win 而不是 virtualenv -p

这是 Unix 的方法: 使用不同的 Python 版本和 virtualenv

同样的方法是否适用于 virtualenvwrapper-win?mkvirtualenv 的来源似乎在第 35 行将参数传递给 virtualenv: https ://github.com/davidmarble/virtualenvwrapper-win/blob/master/scripts/mkvirtualenv.bat

我想我会通过在尝试之前询问这个问题(并可能会弄乱我的 python 环境)来询问是否有人这样做(并告诉其他人他们可以这样做)。

如果你这样做了,有什么要注意的吗?我可以为我的第二个 python 版本使用 ActiveState python 安装吗?

0 投票
3 回答
9610 浏览

python - 如何检查 virtualenv 是否是使用“--no-site-packages”创建的?

有时我会收到我怀疑是我的 Django 应用程序使用全局安装的 Python 模块/Django 应用程序而不是其 virtualenv 中的错误的结果。

有没有办法检查我的应用程序的 virtualenv 是否是使用“--no-site-packages”创建的,而不必删除它,然后按如下方式重新创建它?

肯定有更好的办法!谢谢。