在GitBash ERROR virtualenvwrapper [英] ERROR virtualenvwrapper in GitBash

查看:616
本文介绍了在GitBash ERROR virtualenvwrapper的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在GitBash(Windows 7)中设置virtualenvwrapper。我写的下一行:

 1 $出口WORKON_HOME = $ HOME / .virtualenvs
 2 $出口MSYS_HOME = / C / MSYS / 1.0
 3 $源/usr/local/bin/virtualenvwrapper.sh

I trying to setup virtualenvwrapper in GitBash (Windows 7). I write the next lines: 1 $ export WORKON_HOME=$HOME/.virtualenvs 2 $ export MSYS_HOME=/c/msys/1.0 3 $ source /usr/local/bin/virtualenvwrapper.sh

和最后一行给我一个错误:

 来源/usr/local/bin/virtualenvwrapper.sh
 sh.exe:/usr/local/bin/virtualenvwrapper.sh:没有这样的文件或目录

And the last line give me an error: source /usr/local/bin/virtualenvwrapper.sh sh.exe: /usr/local/bin/virtualenvwrapper.sh: No such file or directory

我发现,在我的驱动器是 virtualenvwrapper.sh 和更改目录名。在我的电脑是 /c/Python27/Scripts/virtualenvwrapper.sh 。当我再次运行命令

I find, where on my drive is virtualenvwrapper.sh and change directory name. On my computer it's /c/Python27/Scripts/virtualenvwrapper.sh. When I again run command

$源/c/Python27/Scripts/virtualenvwrapper.sh

我得到了一个错误信息:

sh.exe:mktemp的:命令未找到错误:virtualenvwrapper无法创建一个临时文件名

I get the next ERROR message: sh.exe":mktemp:command not found ERROR: virtualenvwrapper could not create a temporary file name

我检查我的环境变量: C:\\ python27 \\; C:\\ python27 \\脚本\\; C:\\ python27 \\脚本\\ virtualenvwrapper.sh \\; C:\\ MSYS; C:\\ PROGRAM文件(x86)\\ Git的\\ CMD; C:\\ Program Files文件(x86)的\\ Git的\\ BIN \\

I check my enviroment variable: C:\python27\;C:\python27\scripts\;C:\python27\scripts\virtualenvwrapper.sh\;C:\msys;C:\Program Files (x86)\Git\cmd;C:\Program Files (x86)\Git\bin\

我不知道我犯了一个错误

I don't know where i made a mistake

推荐答案

我发现了这个问题的修复使用GitBash在Windows 8机器上。

I've found a fix for this problem on a Windows 8 machine using GitBash.

获取mktemp的窗户,把它的地方,可以通过GitBash使用,然后编辑virtualenvwrapper.sh和线202,添加具有创建的文件触摸命令。它应该是这样的:

Get mktemp for windows, put it somewhere that can be used by GitBash, then edit virtualenvwrapper.sh and on line 202, add a touch command with the file created. It should look like this:

file="$(virtualenvwrapper_mktemp -t virtualenvwrapper-$suffix-XXXXXXXXXX)"
touch $file  # this is the new line
if [ $? -ne 0 ] || [ -z "$file" ] || [ ! -f "$file" ]

完整的答案:

由于khampson提到的,你必须下载mktemp的,并将其放置在您的Git \\ BIN( C:\\ Program Files文件(x86)的\\的Git \\ BIN 通常情况下)目录。在此之后,运行在 virtualenvwrapper.sh 文件将导致一个错误说:

FULL ANSWER:

As khampson mentioned, you do have to download mktemp and place it where your Git\bin (C:\Program Files (x86)\Git\bin usually) directory is. After that, running the virtualenvwrapper.sh file would cause an error saying:

path = C:/Users/User/AppData/Local/Temp/virtualenvwrapper-initialize-hook-XXXXXX XXXX 
lpPathBuffer = C:\Users\User\AppData\Local\Temp\ 
szTempName = C:\Users\User\AppData\Local\Temp\tmp23A9.tmp 
path = C:\Users\User\AppData\Local\Temp\tmp23A9.tmp 
fd = 3 
ERROR: virtualenvwrapper could not create a temporary file name.

在线202(<一个href=\"https://bitbucket.org/dhellmann/virtualenvwrapper/src/897ae171d909683db7e5cf770da9ca67ea795717/virtualenvwrapper.sh?at=master#cl-202\"相对=nofollow>来源),你看到一个函数调用virtualenvwrapper_mktemp(这只是一个包装函数来调用mktemp的),这应该创建新的临时文件,但显然它不是确实在Windows

On line 202(source), you see a function call to virtualenvwrapper_mktemp (which is just a wrapper function to call mktemp) and this is supposed to create the new temp file, but apparently it doesn't on windows.

通过手册mktemp的走向,在示例部分,可以看到他们总是送点东西给它强制将创建的文件新的文件句柄。

Going through the manual for mktemp, on the examples section, you see that they are always sending something to that new file handle which forces the file to be created.

因此​​,而不是发送使用echo如手动空字符串,只需添加一个touch命令在 virtualenvwrapper.sh

So instead of sending an empty string using echo like the manual, just add a touch command to the virtualenvwrapper.sh:

file="$(virtualenvwrapper_mktemp -t virtualenvwrapper-$suffix-XXXXXXXXXX)"
touch $file   # new command here

这应该强制Windows创建的临时文件。我不能发布,由于低代表的联系休息,但我希望这仍然可以帮助别人。

This should force windows to create the temp file. I can't post the rest of the links due to low rep but I hope this still helps someone.

我创建的virtualenvwrapper回购拉请求,并得到了批准。你可以看到触摸命令,我建议增加<一个href=\"https://bitbucket.org/dhellmann/virtualenvwrapper/src/f2602e81af497a71eae7da68373b17427d5a29a9/virtualenvwrapper.sh?at=master#cl-207\"相对=nofollow>这里。

I created a pull request on the virtualenvwrapper repo and it got approved. You can see the touch command I suggested added here.

这篇关于在GitBash ERROR virtualenvwrapper的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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