尝试pip
安装repo的特定分支.谷歌告诉我
pip install git + https://github.com/user/repo.git@branch
这个分支的名字是issue/34/oscar-0.6
我做的,pip install https://github.com/tangentlabs/django-oscar-paypal.git@/issue/34/oscar-0.6
但它返回404.
我该如何安装这个分支?
我正在开发一个django应用程序,我正在使用pip来管理我的需求.如何安装特定的git提交?
在我的情况下,我需要安装此提交:https: //github.com/aladagemre/django-notification/commit/2927346f4c513a217ac8ad076e494dd1adbf70e1
我有一个包含许多文件夹的git存储库,其中一个是可以用pip安装的python模块,如下所示:
repo.git/
repo.git/folder1/
repo.git/folder2/
repo.git/mymodule/
repo.git/mymodule/__init__.py
repo.git/mymodule/setup.py
repo.git/mymodule/...
Run Code Online (Sandbox Code Playgroud)
现在我必须执行以下安装:
git clone http://server/repo.git
cd repo
pip install mymodule
cd ..
rm -rf repo
Run Code Online (Sandbox Code Playgroud)
是否可以直接使用pip安装模块而无需明确克隆?
我试过了:
pip install git+https://server/repo.git/mymodule/
pip install git+https://server/repo.git:mymodule/
Run Code Online (Sandbox Code Playgroud)
但我得到:
IOError: [Errno 2] No such file or directory: '/tmp/pip-88tlLm-build/setup.py'
Run Code Online (Sandbox Code Playgroud) 这是第一次发生在我身上,我不知道为什么 pip 以如此奇怪的形式输出需求。我正在使用 conda 环境。输出示例pip freeze
:
aioredis @ file:///home/conda/feedstock_root/build_artifacts/aioredis_1591809643295/work
amqp @ file:///home/conda/feedstock_root/build_artifacts/amqp_1591005859311/work
asgiref==3.2.7
async-timeout==3.0.1
attrs==19.3.0
Run Code Online (Sandbox Code Playgroud)
为什么不aioredis
和amqp
各自的版本就像其他要求上市?
我有一个使用 Spacy 模型“en_core_web_sm”的应用程序。我已经在我的本地机器上测试了该应用程序,它运行良好。
但是,当我将它部署到 Heroku 时,它给了我这个错误:
“找不到模型 'en_core_web_sm'。它似乎不是快捷链接、Python 包或数据目录的有效路径。”
我的需求文件包含 spacy==2.2.4。
我一直在研究这个错误,发现需要使用这个命令单独下载模型:
python -m spacy download en_core_web_sm
我一直在寻找将相同内容添加到我的 requirements.txt 文件中的方法,但一直找不到有效的方法!
我也试过这个 - 将以下内容添加到需求文件中:
-e git://github.com/explosion/spacy-models/releases/download/en_core_web_sm-2.2.0/en_core_web_sm-2.2.0.tar.gz#egg=en_core_web_sm==2.2.0
但它给出了这个错误:
“克隆 git://github.com/explosion/spacy-models/releases/download/en_core_web_sm-2.2.0/en_core_web_sm-2.2.0.tar.gz 到 /app/.heroku/src/en-core-web- sm
运行命令 git clone -q git://github.com/explosion/spacy-models/releases/download/en_core_web_sm-2.2.0/en_core_web_sm-2.2.0.tar.gz /app/.heroku/src/en-core -web-sm 致命:远程错误:explosion/spacy-models/releases/download/en_core_web_sm-2.2.0/en_core_web_sm-2.2.0.tar.gz 不是有效的存储库名称”
有没有办法让这个 Spacy 模型从需求文件中加载?或者任何其他可能的修复?
谢谢你。
我正在尝试将一个包添加到我的requirements.txt
文件中,即:
ssh
配置了私人仓库master
,其名称中带有斜杠ssh
协议互联网上到处都是关于这个话题的问题。以下是关于此的pip
文档:
pip install -e "vcs+protocol://repo_url/#egg=pkg&subdirectory=pkg_dir"
以及来自如何在requirements.txt中声明直接github源的GitHub答案
git+git://github.com/path/to/package-two@master#egg=package-two
尝试方法#1
我试图在我的requirements.txt
文件中使用这个答案:
-e git+ssh://github.com/Organization/repo-name.git@branch/name#egg=foo
Run Code Online (Sandbox Code Playgroud)
我收到错误:
ERROR: Command errored out with exit status 128: git clone -q ssh://github.com/Organization/repo-name.git /path/to/venv/src/foo Check the logs for full command output.
Run Code Online (Sandbox Code Playgroud)
当我使用以下选项查看日志时--log
:
-e git+ssh://github.com/Organization/repo-name.git@branch/name#egg=foo
Run Code Online (Sandbox Code Playgroud)
尝试方法#2
我尝试的另一种方法requirements.txt
:
-e git+git@github.com:Organization/repo-name.git#egg=foo
Run Code Online (Sandbox Code Playgroud)
这里面的克隆确实有效!它还打印此警告:DEPRECATION: This form of VCS requirement is being deprecated
不幸的是,我无法弄清楚如何以这种格式指定分支名称。
我究竟做错了什么?我错过了什么吗?
仅供参考,我的版本:
ERROR: …
Run Code Online (Sandbox Code Playgroud) 请在标记为重复之前,我尝试了一系列解决方案,包括此处的一个 ,但没有运气
我创建了一个简单的工具来完成一些任务,并且能够成功地将其打包。
当尝试安装它时,我在使用时获得了所需的效果python setup.py install
,但pip install package_name
只安装了软件包,但没有安装后脚本。
这是我的代码的一部分;
安装程序.py
from distutils import setup
from app.scripts import *
setup(
#Application name
name = "my-app-name",
version = "my-app-version",
author = "my-name",
author_email = "my-email",
packages = ['app'],
include_package_data = True,
license = 'MIT',
url = "https://my-url",
description = "description",
install_requires = ["flake8"],
cmdclass = {
"install":Post_install
}
)
Run Code Online (Sandbox Code Playgroud)
脚本.py
from distutils.command.install import install
import os
class Post_install(install):
@staticmethod
def func():
return True
def run(self): …
Run Code Online (Sandbox Code Playgroud) 我有一个要推送到PyPi的程序包,某些功能不是程序包,而是可安装的git存储库。我requirements.txt
看起来像这样
sphinx_bootstrap_theme>=0.6.5
matplotlib>=2.2.0
numpy>=1.15.0
sphinx>=1.7.5
sphinx-argparse>=0.2.2
tensorboardX
tqdm>=4.24.0
Cython>=0.28.5
# git repos
git+git://github.com/themightyoarfish/svcca-gpu.git
Run Code Online (Sandbox Code Playgroud)
因此,我setup.py
具有以下内容:
#!/usr/bin/env python
from distutils.core import setup
import setuptools
import os
with open('requirements.txt', mode='r') as f:
requirements = f.read()
required_pkgs, required_repos = requirements.split('# git repos')
required_pkgs = required_pkgs.split()
required_repos = required_repos.split()
with open('README.md') as f:
readme = f.read()
setup(name=...
...
packages=setuptools.find_packages('.', include=[...]),
install_requires=required_pkgs,
dependency_links=required_repos,
zip_safe=False, # don't install egg, but source
)
Run Code Online (Sandbox Code Playgroud)
但是运行pip install <package>
实际上并不会安装git依赖项。我认为pip
实际上并没有使用安装脚本。当我python setup.py install
手动运行时,它可以工作。 …
我知道我可以使用如下语法导出 conda 环境:
conda env export -n my_env -f /somewhere/environment.yml
Run Code Online (Sandbox Code Playgroud)
并使用以下命令导入它们:
conda env create -f /somewhere/environment.yml -p /somewhere/else/
Run Code Online (Sandbox Code Playgroud)
但是,如果我从我的私人 github 安装了一个包,使用如下语法:
(my_env) ~/ $ pip install git+https://github.com/user/my_package.git@master#egg=my_package
Run Code Online (Sandbox Code Playgroud)
或者将其放入我的 中requirements.txt
,如下所示:
aiofiles==0.4.0
git+https://github.com/user/my_package.git@master#egg=my_package
chardet==3.0.4
Run Code Online (Sandbox Code Playgroud)
当我导出时,我看到这个:
name: my_env
channels:
- defaults
dependencies:
- ca-certificates=2019.5.15=0
...
- pip:
- aiofiles==0.4.0
- my_package # UH OH, NO github INSTRUCTION OR VERSION
- chardet==3.0.4
Run Code Online (Sandbox Code Playgroud)
这是一个问题,因为当我尝试运行时:
conda env create -f /somewhere/environment.yml -p /somewhere/else/
Run Code Online (Sandbox Code Playgroud)
我收到一条错误,指出 conda 无法安装,因为找不到my_package
. 这是有道理的,环境并没有告诉它去 github 中查找。
我怎样才能要求conda …
我对开发仍然很陌生...
我想简化django-friendship并添加一些不同的功能。我已经在GitHub上进行了分叉。我不确定下一步该怎么做。
我的django-friendship
仓库的本地副本应该放在哪里?我应该将其作为应用程序集成到当前的Django项目中,还是将其设置为单独的项目?在这种情况下,如何在开发时将我的主要Django项目设置为将其用作应用程序?
我可以从这里学到的任何指导或其他资源将不胜感激。
谢谢!