pip로 git 하위 디렉토리에서 어떻게합니까?
많은 폴더가있는 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/...
지금 설치하려는 다음을 수행해야합니다.
git clone http://server/repo.git
cd repo
pip install mymodule
cd ..
rm -rf repo
명시 적으로 복제하지 않고 pip로 모듈을 직접 존재합니까?
나는 시도했다 :
pip install git+https://server/repo.git/mymodule/
pip install git+https://server/repo.git:mymodule/
그러나 나는 얻는다 :
IOError: [Errno 2] No such file or directory: '/tmp/pip-88tlLm-build/setup.py'
이 기능에 대한 풀 리퀘스트 가 외형 , 한 달 전에 브랜치를 개발하기 위해 병합 된 것입니다. 구문은 다음과 가변 .
pip install -e git+https://git.repo/some_repo.git#egg=version_subpkg&subdirectory=repo # install a python package from a repo subdirectory
마스터에 병합되어 배포 될 때까지 잠시 기다려야 할 것입니다.
업데이트 : 이제 https://pip.readthedocs.io/en/stable/reference/pip_install/#vcs-support
에서 다음과 같이 사용할 수 있고 문서화 합니다.setup.py가 프로젝트의 루트에없는 프로젝트의 경우 "하위 디렉토리"구성 요소가 사용됩니다. "subdirectory"구성 요소의 값은 프로젝트의 루트에서 setup.py가있는 경로를 집집합니다.
따라서 저장소 레이아웃이 다음과 같은 경우 :
- pkg_dir/ - setup.py # setup.py for package ``pkg`` - some_module.py - other_dir/ - some_file - some_other_file
당신은 선호합니다
pip install -e vcs+protocol://repo_url/#egg=pkg&subdirectory=pkg_dir
참고 : Windows에서는 URL을 큰 따옴표로 묶어야합니다. " '하위 디렉토리'가 내부 또는 외부 명령으로 인식되지 않습니다."라는 오류 메시지가 표시됩니다. 예 :
pip install -e "vcs+protocol://repo_url#egg=pkg&subdirectory=pkg_dir"
아래 정답 주석 중 하나에 이미 언급되어 있지만이 문제를 강조하기 위해 리눅스 줄에서 실행할 명령 때 앰퍼샌드가 명령 줄에 백그라운드에서 명령을 실행하도록 지시하므로 -를 문자 이스케이프 해야 우리합니다&
.
git+https://git.repo/some_repo.git#egg=version_subpkg\&subdirectory=repo
앰퍼샌드 앞에 백 슬래시가 있습니다. 이스케이프 동작은 Linux 배포판에 따라 동작 수 있습니다. 나는 전문가가 아닙니다.
무시 무시하면 다음과 같은 비밀 오류가 보관됩니다.
bash: (...) command not found
참고 URL : https://stackoverflow.com/questions/13566200/how-can-i-install-from-a-git-subdirectory-with-pip
'ProgramingTip' 카테고리의 다른 글
`git add .`와`git add -u`의 차이점은 무엇입니까? (0) | 2020.11.08 |
---|---|
클러스터 수를 알 수없는 비지도 클러스터링 (0) | 2020.11.08 |
메모장 ++ (v6.5)에서 탭 너비를 늘리려면 어떻게해야해야합니까? (0) | 2020.11.08 |
Nuget 통합 대 업데이트 (0) | 2020.11.08 |
gnuplot 파일에 대한 표준 파일 듣고가 있습니까? (0) | 2020.11.08 |