【问题标题】:I can't install any github project with Pip我无法使用 Pip 安装任何 github 项目
【发布时间】:2018-05-04 20:04:42
【问题描述】:

我不得不在 Windows 上重新安装很多库。当我想从 github 安装 pycdc 时

在 Windows 上安装 pycdc。

pip install git+https://github.com/zrax/pycdc.git

我明白了:

FileNotFoundError: [Errno 2] 没有这样的文件或目录:'C:\Users\TT\AppData\Local\Temp\pip-ashu2b4z-build\setup.py

C:\Users\TT\unroll>pycdc .py
'pycdc' is not recognized as an internal or external command,
operable program or batch file.

C:\Users\TT\unroll>pip install git+https://github.com/zrax/pycdc.git
Collecting git+https://github.com/zrax/pycdc.git
  Cloning https://github.com/zrax/pycdc.git to c:\users\TT\appdata\local\temp\pip-ashu2b4z-build
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\TT\Anaconda3\lib\tokenize.py", line 452, in open
        buffer = _builtin_open(filename, 'rb')
    FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\TT\\AppData\\Local\\Temp\\pip-ashu2b4z-build\\setup.py'

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\TT\AppData\Local\Temp\pip-ashu2b4z-build\

C:\Users\TT\unroll>pip install git+https://github.com/zrax/pycdc.git

我觉得我缺少一些依赖文件

我有没有后悔过重新安装。 python 可能很好用,但设置起来却是一场噩梦

还有:

C:\Users\TT>pip install git+ssh://git@github.com/BlahCo/search/tree/prod_release_branch/ProductName
Collecting git+ssh://git@github.com/BlahCo/search/tree/prod_release_branch/ProductName
  Cloning ssh://git@github.com/BlahCo/search/tree/prod_release_branch/ProductName to c:\users\TT\appdata\local\temp\pip-6x2kywme-build
The authenticity of host 'github.com (192.30.255.113)' can't be established.
RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.
Are you sure you want to continue connecting (yes/no)? y
Please type 'yes' or 'no': yes
Warning: Permanently added 'github.com,192.30.255.113' (RSA) to the list of known hosts.
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights

Command "git clone -q ssh://git@github.com/BlahCo/search/tree/prod_release_branch/ProductName C:\Users\TT\AppData\Local\Temp\pip-6x2kywme-build" failed with error code 128 in None

【问题讨论】:

  • pycdc.py 之间的空格是什么?非常标准的 'pycdc' 不被识别为内部或外部命令 windows 命令错误很好地告诉你这一点,所以逻辑应该告诉你它应该是pycdc.py。其次,您的 pip 命令给出了无法找到C:\\Users\\TT\\AppData\\Local\\Temp\\pip-ashu2b4z-build\\setup.py 的错误,您是否验证了您的文件确实存在于该位置?
  • @GerhardBarnard 不确定您的意思,但我无法理解:pip install -U git+github.com/zrax/pycdc or.zip 变体工作
  • 我的意思是,setup.py 是否存在于C:\Users\TT\AppData\Local\Temp\pip-ashu2b4z-build 中?
  • @GerhardBarnard 不这么认为。
  • 那是一个问题,你为什么不检查?这是预期的,因此您的应用程序可能没有按预期提取文件。

标签: python git github cmd pip


【解决方案1】:

您似乎面临两个不同的问题。 首先,对于 pycdc: Pycdc 似乎不是 python 包,因此使用 pip 安装它确实有意义(但没有找到 setup.py 是合乎逻辑的) 检查那里的 github (https://github.com/zrax/pycdc) 看来您需要在那里下载源代码并构建它。

第二,BlahCo: 您正在尝试通过ssh 而不是https 下载源代码来安装它(就像您尝试使用pycdc 一样)。如果您尝试使用ssh,则需要使用您的 ssh 公钥配置您的 github 帐户。 错误git@github.com: Permission denied (publickey) 表明您没有正确配置您的帐户 更多详情见:https://help.github.com/articles/connecting-to-github-with-ssh/

【讨论】:

  • 我知道这些问题,但我该如何解决。 Windows 上的任何和所有 github 内容都存在此问题(即使在重新安装的新电脑中)
【解决方案2】:

在您的要求中,将带有个人令牌的 URL 添加到 github 存储库。

munch
pprint
coloredlogs
git+https://104360bcf4d8a00198bd355d73110ba75866c3e8:@github.company.com/kubernetes-paas/paas-shared-modules.git@master

安装将使用 https API 而不是 ssh,因为您无法提供密钥。

$ pip3 install -r requirements.txt
Collecting git+https://104360bcf4d8a00198bd355d73110ba75866c3e8:@github.company.com/kubernetes-paas/paas-shared-modules.git@master (from -r requirements.txt (line 6))
  Cloning https://104360bcf4d8a00198bd355d73110ba75866c3e8:@github.company.com/kubernetes-paas/paas-shared-modules.git (to master) to /private/var/folders/c8/p20lpvwn1kl7cyk7b282s3x1j2r82f/T/pip-2py7sl6t-build

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-11-14
    • 2020-02-23
    • 2013-06-29
    • 2012-03-27
    相关资源
    最近更新 更多