使用pip安装私有github存储库时遇到问题 - python

首先,我已经看过这个问题Is it possible to use pip to install a package from a private github repository?

我试图从我可以使用pip访问的专用存储库中安装软件包。

我可以像这样直接克隆它:

(myenv)robbie@ubuntu:~/git$ git clone [email protected]:matherbk/django-messages.git
Cloning into 'django-messages'...
remote: Counting objects: 913, done.
remote: Compressing objects: 100% (345/345), done.
remote: Total 913 (delta 504), reused 913 (delta 504)
Receiving objects: 100% (913/913), 165.73 KiB, done.
Resolving deltas: 100% (504/504), done.

但是,当我尝试通过pip安装它时(我的virtualenv已激活):

(myenv)robbie@ubuntu:~/git$ pip install git+https://[email protected]/matherbk/django-messages.gitDownloading/unpacking git+https://[email protected]/matherbk/django-messages.git
  Cloning https://[email protected]/matherbk/django-messages.git to /tmp/pip-13ushS-build
Password for 'https://[email protected]': 
fatal: Authentication failed
  Complete output from command /usr/bin/git clone -q https://[email protected]/matherbk/django-messages.git /tmp/pip-13ushS-build:

----------------------------------------
Command /usr/bin/git clone -q https://[email protected]/matherbk/django-messages.git /tmp/pip-13ushS-build failed with error code 128 in None
Storing complete log in /home/robbie/.pip/pip.log

我尝试输入密码,但失败。但是我通过[email protected]的ssh认证:

(myenv)robbie@ubuntu:~/git$ ssh -T [email protected]
Hi robpodosek! You've successfully authenticated, but GitHub does not provide shell access.

我可以将[email protected]切换为[email protected],它可以让我通过pip进行安装:

(myenv)robbie@ubuntu:~/git$ pip install git+https://[email protected]/matherbk/django-messages.git
Downloading/unpacking git+https://[email protected]/matherbk/django-messages.git
  Cloning https://[email protected]/matherbk/django-messages.git to /tmp/pip-SqEan9-build
Password for 'https://[email protected]': 
  Running setup.py egg_info for package from git+https://[email protected]/matherbk/django-messages.git

    warning: no files found matching 'README'
Installing collected packages: django-messages
  Running setup.py install for django-messages

    warning: no files found matching 'README'
Successfully installed django-messages
Cleaning up...

但是我想通过使用[email protected]来做第一篇提到的文章,所以我不必将用户名添加到requirements.txt文件中并将其添加到版本控制中。

有什么想法吗?我以前可以进行此工作,但必须重新启动映像。提前谢谢。

参考方案

它通过使用oxyum的建议将其更改为:

pip install git+ssh://[email protected]/matherbk/django-messages.git

Git-Pipfile.lock是否应提交版本控制? - python

当两个开发人员在具有不同操作系统的项目上工作时,Pipfile.lock是不同的(尤其是host-environment-markers内部的部分)。 For PHP, most people recommend to commit composer.lock 文件。我们必须对Python做同样的事情吗? 参考方案 简短-是的!锁定文件会准确告知Pipenv…

Python GPU资源利用 - python

我有一个Python脚本在某些深度学习模型上运行推理。有什么办法可以找出GPU资源的利用率水平?例如,使用着色器,float16乘法器等。我似乎在网上找不到太多有关这些GPU资源的文档。谢谢! 参考方案 您可以尝试在像Renderdoc这样的GPU分析器中运行pyxthon应用程序。它将分析您的跑步情况。您将能够获得有关已使用资源,已用缓冲区,不同渲染状态上…

Python:图像处理可产生皱纹纸效果 - python

也许很难描述我的问题。我正在寻找Python中的算法,以在带有某些文本的白色图像上创建皱纹纸效果。我的第一个尝试是在带有文字的图像上添加一些真实的皱纹纸图像(具有透明度)。看起来不错,但副作用是文本没有真正起皱。所以我正在寻找更好的解决方案,有什么想法吗?谢谢 参考方案 除了使用透明性之外,假设您有两张相同尺寸的图像,一张在皱纹纸上明亮,一张在白色背景上有深…

Python uuid4,如何限制唯一字符的长度 - python

在Python中,我正在使用uuid4()方法创建唯一的字符集。但是我找不到将其限制为10或8个字符的方法。有什么办法吗?uuid4()ffc69c1b-9d87-4c19-8dac-c09ca857e3fc谢谢。 参考方案 尝试:x = uuid4() str(x)[:8] 输出:"ffc69c1b" Is there a way to…

Python sqlite3数据库已锁定 - python

我在Windows上使用Python 3和sqlite3。我正在开发一个使用数据库存储联系人的小型应用程序。我注意到,如果应用程序被强制关闭(通过错误或通过任务管理器结束),则会收到sqlite3错误(sqlite3.OperationalError:数据库已锁定)。我想这是因为在应用程序关闭之前,我没有正确关闭数据库连接。我已经试过了: connectio…