在 Cygwin 中安装 virtualenvwrapper 时出现问题

Problems installing virtualenvwrapper in Cygwin

我正在尝试从一本名为 "TDD with Python"、OS W10 的书开始。作为设置的一部分,它希望您安装 virtualenvwrapper。建议在 Windows...

Python版本是3.6。我通过

安装了 virtualenvwrapper
pip install virtualenvwrapper

这似乎工作正常。

尝试将相关设置行添加到我的 .bashrc 中并不顺利:

echo "source virtualenvwrapper.sh" >> ~/.bashrc
source ~/.bashrc

输出:

/usr/bin/python: No module named virtualenvwrapper virtualenvwrapper.sh: There was a problem running the initialization hooks.

If Python could not import the module virtualenvwrapper.hook_loader, check that virtualenvwrapper has been installed for VIRTUALENVWRAPPER_PYTHON=/usr/bin/python and that PATH is set properly.

至少这证明 virtualenvwrapper.sh 正在 运行...

实际上没有 /usr/bin 这样的目录...所以我在 .bashrc 中添加了前一行,指向我希望它可能希望看到的内容 VIRTUALENVWRAPPER_PYTHON 环境变量(我们在 Linux 中这样称呼它们吗?)。

VIRTUALENVWRAPPER_PYTHON=/cygdrive/d/apps/Python/Python36/Lib/site-packages/virtualenvwrapper

现在我得到

bash: /cygdrive/d/apps/Python/Python36/Lib/site-packages/virtualenvwrapper: Is a directory virtualenvwrapper.sh: There was a problem running the initialization hooks.

If Python could not import the module virtualenvwrapper.hook_loader, check that virtualenvwrapper has been installed for VIRTUALENVWRAPPER_PYTHON=/cygdrive/d/apps/Python/Python36/Lib/site-packages/virtualenvwrapper and that PATH is set properly.

主要问题:VIRTUALENVWRAPPER_PYTHON指的是什么?可执行文件?任何帮助我识别所需目标的线索都将不胜感激!

POST-ANSWER ENLIGHTENMENT 以防万一有人这样绊倒,只是想让你知道:在 phd 给我答案之后我找到了其他问题。

最终我通过这样做安装了 virtualenvwrapper:

pip uninstall virtualenvwrapper

...使用最新的 Cygwin 安装程序 .exe 安装 pip3。注意 3!

然后去

pip3 install virtualenvwrapper
echo "source virtualenvwrapper.sh" >> ~/.bashrc
source ~/.bashrc

...成功!但很快又出现了另一个谜题:参见 .

VIRTUALENVWRAPPER_PYTHON 应指向 python 二进制:/usr/bin/python,例如