文章目錄
- 1.安裝python3.7以及pip3
- 2.使用pip3安裝pipenv時pip報錯
- 3.使用pip3安裝pipenv時出現ReadTimeoutError
- 4.查看pipenv版本報錯
1.安裝python3.7以及pip3
1)首先來安裝依賴
yum -y install gcc gcc-c++
yum -y groupinstall “Development tools”
yum install openssl-devel bzip2-devel expat-devel gdbm-devel readline-devel sqlite-devel libffi-devel
2)然后下載 Python-3.7.0 的源碼并解壓:
mkdir -p ~/src
cd ~/src
wget https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tgz
tar -zxvf Python-3.7.0.tgz
3)編譯安裝:
cd Python-3.7.0
./configure –prefix=/usr/local/python3
make && make install
4)最后創建軟鏈接
ln -s /usr/local/python3/bin/python3 /usr/bin/python3
ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3
5)測試
python3 --version
pip3 --version
升級pip3命令:
pip3 install –upgrade pip
2.使用pip3安裝pipenv時pip報錯
安裝指令:
pip3 install pipenv
錯誤信息:
pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Collecting virtualenvRetrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/virtualenv/Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/virtualenv/Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/virtualenv/Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/virtualenv/Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/virtualenv/Could not fetch URL https://pypi.org/simple/virtualenv/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/virtualenv/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skippingCould not find a version that satisfies the requirement virtualenv (from versions: )
No matching distribution found for virtualenv
pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping
原因:
yum 安裝的openssl 版本都比較低,即pip依賴出現問題,導致pip未夠正常使用,需要更新依賴!
解決方案:
戳這里 謝謝作者分享!
3.使用pip3安裝pipenv時出現ReadTimeoutError
安裝指令:
pip3 install pipenv
錯誤信息(此時簡略錯誤信息):
ReadTimeoutError
解決方案:
使用以下指令:
pip3 --default-timeout=100 install pipenv
4.查看pipenv版本報錯
[root@instance-6lf3j8lp Python-3.7.0]# pipenv --version
-bash: pipenv: command not found
原因:未建立軟鏈接
解決方案:
ln -s /usr/local/python3/bin/pipenv /usr/bin/pipenv