项目场景:
用git下载包并用pip安装时出现错误
报错:
ERROR: Error [Errno 2] No such file or directory: ‘git’: ‘git’ while executing command git version
ERROR: Cannot find command ‘git’ - do you have ‘git’ installed and in your PATH?
解决办法
但是用pip或者sudo apt-get update sudo apt-get install git 都不能成功安装git:
因此尝试用conda安装git。
conda install git
成功安装git:
(sportsformer) xzy@ps:~/InternVL/Mycode$ conda install git
Solving environment: done
## Package Plan ##
environment location: /home/xzy/.conda/envs/sportsformer
added / updated specs:
- git
The following packages will be downloaded:
package | build
---------------------------|-----------------
krb5-1.19.3 | h3790be6_0 1.4 MB http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
perl-5.32.1 | 2_h7f98852_perl5 14.4 MB http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
libiconv-1.17 | h166bdaf_0 1.4 MB http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
libnghttp2-1.47.0 | hdcd2b5c_1 808 KB http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
libcurl-7.86.0 | h7bff187_1 348 KB http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
expat-2.5.0 | h27087fc_0 189 KB http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
libssh2-1.10.0 | haa6b8db_3 234 KB http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
c-ares-1.18.1 | h7f98852_0 113 KB http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
curl-7.86.0 | h7bff187_1 91 KB http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
pcre2-10.40 | hc3806b6_0 2.3 MB http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
libev-4.33 | h516909a_1 104 KB http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
gettext-0.21.1 | h27087fc_0 4.1 MB http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
libedit-3.1.20191231 | he28a2e2_2 121 KB http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
libnsl-2.0.0 | h7f98852_0 31 KB http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
bzip2-1.0.8 | h7f98852_4 484 KB http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
git-2.38.1 | pl5321h5e804b7_1 15.2 MB http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
keyutils-1.6.1 | h166bdaf_0 115 KB http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
------------------------------------------------------------
Total: 41.4 MB
The following NEW packages will be INSTALLED:
bzip2: 1.0.8-h7f98852_4 http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
c-ares: 1.18.1-h7f98852_0 http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
curl: 7.86.0-h7bff187_1 http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
expat: 2.5.0-h27087fc_0 http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
gettext: 0.21.1-h27087fc_0 http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
git: 2.38.1-pl5321h5e804b7_1 http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
keyutils: 1.6.1-h166bdaf_0 http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
krb5: 1.19.3-h3790be6_0 http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
libcurl: 7.86.0-h7bff187_1 http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
libedit: 3.1.20191231-he28a2e2_2 http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
libev: 4.33-h516909a_1 http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
libiconv: 1.17-h166bdaf_0 http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
libnghttp2: 1.47.0-hdcd2b5c_1 http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
libnsl: 2.0.0-h7f98852_0 http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
libssh2: 1.10.0-haa6b8db_3 http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
pcre2: 10.40-hc3806b6_0 http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
perl: 5.32.1-2_h7f98852_perl5 http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
Proceed ([y]/n)? y
Downloading and Extracting Packages
krb5-1.19.3 | 1.4 MB | ###################################################################################################################################
perl-5.32.1 | 14.4 MB | ###################################################################################################################################
libiconv-1.17 | 1.4 MB | ###################################################################################################################################
libnghttp2-1.47.0 | 808 KB | ###################################################################################################################################
libcurl-7.86.0 | 348 KB | ###################################################################################################################################
expat-2.5.0 | 189 KB | ###################################################################################################################################
libssh2-1.10.0 | 234 KB | ###################################################################################################################################
c-ares-1.18.1 | 113 KB | ###################################################################################################################################
curl-7.86.0 | 91 KB | ###################################################################################################################################
pcre2-10.40 | 2.3 MB | ###################################################################################################################################
libev-4.33 | 104 KB | ###################################################################################################################################
gettext-0.21.1 | 4.1 MB | ###################################################################################################################################
libedit-3.1.20191231 | 121 KB | ###################################################################################################################################
libnsl-2.0.0 | 31 KB | ###################################################################################################################################
bzip2-1.0.8 | 484 KB | ###################################################################################################################################
git-2.38.1 | 15.2 MB | ###################################################################################################################################
keyutils-1.6.1 | 115 KB | ###################################################################################################################################
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
接着用pip和git安装nlg-eval:
(sportsformer) xzy@ps:~/InternVL/Mycode$ pip install git+https://github.com/Maluuba/nlg-eval.git@master
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting git+https://github.com/Maluuba/nlg-eval.git@master
Cloning https://github.com/Maluuba/nlg-eval.git (to revision master) to /tmp/pip-req-build-3tzqjzfp
Running command git clone --filter=blob:none -q https://github.com/Maluuba/nlg-eval.git /tmp/pip-req-build-3tzqjzfp
Resolved https://github.com/Maluuba/nlg-eval.git to commit 2ab4528fad5548315cf61e40c2249fec8c8ad233
Preparing metadata (setup.py) ... done
Collecting click>=6.3
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/4a/a8/0b2ced25639fb20cc1c9784de90a8c25f9504a7f18cd8b5397bd61696d7d/click-8.0.4-py3-none-any.whl (97 kB)
|████████████████████████████████| 97 kB 5.7 MB/s
Collecting nltk>=3.4.5
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/c5/ea/84c7247f5c96c5a1b619fe822fb44052081ccfbe487a49d4c888306adec7/nltk-3.6.7-py3-none-any.whl (1.5 MB)
|████████████████████████████████| 1.5 MB 99.0 MB/s
Requirement already satisfied: numpy>=1.11.0 in /home/xzy/.conda/envs/sportsformer/lib/python3.6/site-packages (from nlg-eval==2.4.1) (1.19.5)
Collecting psutil>=5.6.2
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/c5/4f/0e22aaa246f96d6ac87fe5ebb9c5a693fbe8877f537a1022527c47ca43c5/psutil-5.9.8-cp36-abi3-manylinux_2_12_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (288 kB)
|████████████████████████████████| 288 kB 118.5 MB/s
Requirement already satisfied: requests>=2.19 in /home/xzy/.conda/envs/sportsformer/lib/python3.6/site-packages (from nlg-eval==2.4.1) (2.27.1)
Requirement already satisfied: six>=1.11 in /home/xzy/.conda/envs/sportsformer/lib/python3.6/site-packages (from nlg-eval==2.4.1) (1.16.0)
Collecting Cython>=0.28.5
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/94/12/3006eec0c5c4efd98c37dd196fdcffbeb584e8aa5daae15c58636893c18c/Cython-3.0.10-cp36-cp36m-manylinux_2_17_x86_64.whl (3.5 MB)
|████████████████████████████████| 3.5 MB 148.5 MB/s
Collecting scipy>=0.17.0
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/c8/89/63171228d5ced148f5ced50305c89e8576ffc695a90b58fe5bb602b910c2/scipy-1.5.4-cp36-cp36m-manylinux1_x86_64.w
|████████████████████████████████| 25.9 MB 157 kB/s
Collecting scikit-learn>=0.17
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/d3/eb/d0e658465c029feb7083139d9ead51000742e88b1fb7f1504e19e1b4ce6e/scikit_learn-0.24.2-cp36-cp36m-manylinux20B)
|████████████████████████████████| 22.2 MB 67 kB/s
Collecting gensim~=3.8.3
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/2b/e0/fa6326251692056dc880a64eb22117e03269906ba55a6864864d24ec8b4e/gensim-3.8.3-cp36-cp36m-manylinux1_x86_64.
|████████████████████████████████| 24.2 MB 67 kB/s
Collecting Theano>=0.8.1
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/6b/97/bcd5654ba60f35f180931afabbd3b4c46c0379852f961c7a2819ff897f5d/Theano-1.0.5.tar.gz (2.8 MB)
|████████████████████████████████| 2.8 MB 107.4 MB/s
Preparing metadata (setup.py) ... done
Requirement already satisfied: tqdm>=4.24 in /home/xzy/.conda/envs/sportsformer/lib/python3.6/site-packages (from nlg-eval==2.4.1) (4.64.1)
Collecting xdg
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/ea/09/4a0f30aada49e142b94bbb232c023abcbc6ced7e2a9776533fb14977e9db/xdg-5.1.1-py3-none-any.whl (5.0 kB)
Collecting importlib-metadata
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/a0/a1/b153a0a4caf7a7e3f15c2cd56c7702e2cf3d89b1b359d1f1c5e59d68f4ce/importlib_metadata-4.8.3-py3-none-any.whl
Collecting smart-open>=1.8.1
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/ad/08/dcd19850b79f72e3717c98b2088f8a24b549b29ce66849cd6b7f44679683/smart_open-7.0.1-py3-none-any.whl (60 kB)
|████████████████████████████████| 60 kB 6.5 MB/s
Collecting regex>=2021.8.3
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/18/02/d7ba6749c5b7a6f75d6cf287942c800f63e98440dd03e406ed5f01c2b9db/regex-2023.8.8-cp36-cp36m-manylinux_2_17_x86_64.whl (759 kB)
|████████████████████████████████| 759 kB 98.3 MB/s
Collecting joblib
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/7c/91/d3ba0401e62d7e42816bc7d97b82d19c95c164b3e149a87c0a1c026a735e/joblib-1.1.1-py2.py3-none-any.whl (309 kB)
|████████████████████████████████| 309 kB 160.8 MB/s
Requirement already satisfied: charset-normalizer~=2.0.0 in /home/xzy/.conda/envs/sportsformer/lib/python3.6/site-packages (from requests>=2.19->nlg-eval==2.4.1) (2.0
Requirement already satisfied: certifi>=2017.4.17 in /home/xzy/.conda/envs/sportsformer/lib/python3.6/site-packages (from requests>=2.19->nlg-eval==2.4.1) (2024.6.2)
Requirement already satisfied: idna<4,>=2.5 in /home/xzy/.conda/envs/sportsformer/lib/python3.6/site-packages (from requests>=2.19->nlg-eval==2.4.1) (3.7)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in /home/xzy/.conda/envs/sportsformer/lib/python3.6/site-packages (from requests>=2.19->nlg-eval==2.4.1) (1.26.18
Collecting threadpoolctl>=2.0.0
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/61/cf/6e354304bcb9c6413c4e02a747b600061c21d38ba51e7e544ac7bc66aecc/threadpoolctl-3.1.0-py3-none-any.whl (14 k
Requirement already satisfied: importlib-resources in /home/xzy/.conda/envs/sportsformer/lib/python3.6/site-packages (from tqdm>=4.24->nlg-eval==2.4.1) (5.4.0)
Collecting wrapt
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/66/50/1c5ccb23dd63f8f3d312dc2d5e0e64c681faf7c2388fa1ab2553713cef11/wrapt-1.16.0-cp36-cp36m-manylinux_2_5_x86_manylinux_2_17_x86_64.manylinux2014_x86_64.whl (77 kB)
|████████████████████████████████| 77 kB 5.7 MB/s
Requirement already satisfied: zipp>=0.5 in /home/xzy/.conda/envs/sportsformer/lib/python3.6/site-packages (from importlib-metadata->click>=6.3->nlg-eval==2.4.1) (3.6
Requirement already satisfied: typing-extensions>=3.6.4 in /home/xzy/.conda/envs/sportsformer/lib/python3.6/site-packages (from importlib-metadata->click>=6.3->nlg-ev
Building wheels for collected packages: nlg-eval, Theano
Building wheel for nlg-eval (setup.py) ... done
Created wheel for nlg-eval: filename=nlg_eval-2.4.1-py3-none-any.whl size=98924400 sha256=3ecbbc29be15dff1217dedc2b85eff7b43de81f51a01be6f50729e2d39ec2fdb
Stored in directory: /tmp/pip-ephem-wheel-cache-clj0dxcf/wheels/ef/3b/5a/d7c919c82d24410162ed850529af95cc577a34a2bf64bd032a
Building wheel for Theano (setup.py) ... done
Created wheel for Theano: filename=Theano-1.0.5-py3-none-any.whl size=2668111 sha256=6e72ed9821ad18fd2c4367c4a127740493b1f736f2019f4afc0856ec4b428d9a
Stored in directory: /home/xzy/.cache/pip/wheels/64/2e/58/c9d2d9527c58959cca0aaff00d246b0afd5e895eefd326124c
Successfully built nlg-eval Theano
Installing collected packages: wrapt, importlib-metadata, threadpoolctl, smart-open, scipy, regex, joblib, click, xdg, Theano, scikit-learn, psutil, nltk, gensim, Cyt
Successfully installed Cython-3.0.10 Theano-1.0.5 click-8.0.4 gensim-3.8.3 importlib-metadata-4.8.3 joblib-1.1.1 nlg-eval-2.4.1 nltk-3.6.7 psutil-5.9.8 regex-2023.8.8scipy-1.5.4 smart-open-7.0.1 threadpoolctl-3.1.0 wrapt-1.16.0 xdg-5.1.1
解决问题!!!