问题描述
在Windows 10上使用Python 3.7.6,我正在尝试直接从git存储库升级安装的软件包:
Using Python 3.7.6 on Windows 10, I'm trying to upgrade a package installed directly from a git repository:
pip install --upgrade git+https://url.of.my/py/package.git
安装失败:
...
error: file 'C:\Users\myuser\AppData\Local\Temp\pip-req-build-ip4k0pfs\bin\some-script' does not exist
...
就我能够解决的原因如下:早期,点子通话
As far as I've been able to work out, for the following reason: early on, pip calls
git clone -q https://url.of.my/py/package.git 'C:\Users\myuser\AppData\Local\Temp\pip-req-build-ip4k0pfs'
即它将签出存储库到一个临时目录中.但是,未创建目录,并且没有签出任何源.确实,当我在Windows命令行上运行命令时(我也尝试过Git Bash和MSYS2 Bash,同样的问题),我得到一个错误:
i.e. it checks out the repository into a temporary directory. However, the directory isn't created and no sources are checked out. Indeed, when I run the command on the Windows command line (I've also tried Git Bash and MSYS2 Bash, same problem), I get an error:
C:\Users\myuser>git clone -q https://url.of.my/py/package.git 'C:\Users\myuser\AppData\Local\Temp\pip-req-build-ip4k0pfs'
fatal: could not create leading directories of ''C:\Users\myuser\AppData\Local\Temp\pip-req-build-ip4k0pfs'': Invalid argument
问题在于临时目录路径周围的单引号.将它们更改为双引号会使错误消失:
The problem are the single quotes around the path to the temporary directory. Changing them to double quotes makes the error disappear:
C:\Users\myuser>git clone -q https://url.of.my/py/package.git "C:\Users\myuser\AppData\Local\Temp\pip-req-build-ip4k0pfs"
问题
有没有办法告诉点子使用双引号而不是单引号?还有其他有关如何解决此问题的想法吗?
Question
Is there any way to tell pip to use double instead of single quotes? Any other ideas for how to overcome this problem?
- 同时,我还尝试了pip 20.1的Python 3.8.2,并得到了相同的错误
推荐答案
正如@sinoroc所怀疑的那样,引号(或者更确切地说,如果直接执行,则记录的git命令不起作用的事实)是一个红色鲱鱼,并且实际的问题是我的setup.py
有一个错字:scripts
列表中包含一个名为bin/some-script
的文件,该文件实际上名为bin/some-script.py
,因此找不到.
As @sinoroc suspected, the quotes — or rather, the fact that the logged git command doesn't work if directly executed — were a red herring, and the actual problem was that my setup.py
had a typo: the scripts
list included a file named bin/some-script
, which was actually named bin/some-script.py
, and thus couldn't be found.
这篇关于从git信息库安装Pip,由于引号错误而导致错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!