python 离线安装python环境

Last updated on November 26, 2025 am

🧙 Questions

3.6.8python版本各种离线模块安装

☄️ Ideas

离线安装python3
mkdir -p /tmp/python
cd /tmp/python

wget https://openfly.oss-cn-shanghai.aliyuncs.com/python/python3-wheel-0.31.1-5.el7_7.noarch.rpm
wget https://openfly.oss-cn-shanghai.aliyuncs.com/python/python3-test-3.6.8-17.el7.x86_64.rpm
wget https://openfly.oss-cn-shanghai.aliyuncs.com/python/python3-setuptools-39.2.0-10.el7.noarch.rpm
wget https://openfly.oss-cn-shanghai.aliyuncs.com/python/python3-rpm-macros-3-34.el7.noarch.rpm
wget https://openfly.oss-cn-shanghai.aliyuncs.com/python/python3-rpm-generators-6-2.el7.noarch.rpm
wget https://openfly.oss-cn-shanghai.aliyuncs.com/python/python3-pip-9.0.3-8.el7.noarch.rpm
wget https://openfly.oss-cn-shanghai.aliyuncs.com/python/python3-libs-3.6.8-17.el7.x86_64.rpm
wget https://openfly.oss-cn-shanghai.aliyuncs.com/python/python3-3.6.8-17.el7.x86_64.rpm
wget https://openfly.oss-cn-shanghai.aliyuncs.com/python/python-rpm-macros-3-34.el7.noarch.rpm
wget https://openfly.oss-cn-shanghai.aliyuncs.com/python/python3-devel-3.6.8-17.el7.x86_64.rpm

rpm -ivh /tmp/python/python*
离线安装模块requests

按照顺序执行

cd /tmp/python

wget https://openfly.oss-cn-shanghai.aliyuncs.com/python/request/certifi-2018.1.18-py2.py3-none-any.whl
wget https://openfly.oss-cn-shanghai.aliyuncs.com/python/request/chardet-3.0.4-py2.py3-none-any.whl
wget https://openfly.oss-cn-shanghai.aliyuncs.com/python/request/idna-2.6-py2.py3-none-any.whl
wget https://openfly.oss-cn-shanghai.aliyuncs.com/python/request/requests-2.18.4-py2.py3-none-any.whl
wget https://openfly.oss-cn-shanghai.aliyuncs.com/python/request/urllib3-1.22-py2.py3-none-any.whl

python3 -m pip install /tmp/python/certifi-2018.1.18-py2.py3-none-any.whl
python3 -m pip install /tmp/python/chardet-3.0.4-py2.py3-none-any.whl
python3 -m pip install /tmp/python/idna-2.6-py2.py3-none-any.whl
python3 -m pip install /tmp/python/urllib3-1.22-py2.py3-none-any.whl
python3 -m pip install /tmp/python/requests-2.18.4-py2.py3-none-any.whl
离线安装模块redis

如何找寻离线安装包
python3 -m pip uninstall importlib-metadata
python3 -m pip uninstall redis
python3 -m pip install /tmp/redis-4.3.4-py3-none-any.whl
去阿里云下载 https://mirrors.aliyun.com/pypi/xxxxx
https://mirrors.aliyun.com/pypi/packages/bd/df/d4a4974a3e3957fd1c1fa3082366d7fff6e428ddb55f074bf64876f8e8ad/zipp-3.6.0-py3-none-any.whl

cd /tmp/python

wget https://openfly.oss-cn-shanghai.aliyuncs.com/python/redis/pyparsing-3.1.2-py3-none-any.whl
wget https://openfly.oss-cn-shanghai.aliyuncs.com/python/redis/wrapt-1.16.0-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
wget https://openfly.oss-cn-shanghai.aliyuncs.com/python/redis/typing_extensions-4.1.1-py3-none-any.whl
wget https://openfly.oss-cn-shanghai.aliyuncs.com/python/redis/async_timeout-4.0.2-py3-none-any.whl 
wget https://openfly.oss-cn-shanghai.aliyuncs.com/python/redis/Deprecated-1.2.14-py2.py3-none-any.whl
wget https://openfly.oss-cn-shanghai.aliyuncs.com/python/redis/packaging-21.3-py3-none-any.whl
wget https://openfly.oss-cn-shanghai.aliyuncs.com/python/redis/zipp-3.6.0-py3-none-any.whl
wget https://openfly.oss-cn-shanghai.aliyuncs.com/python/redis/importlib_metadata-4.8.3-py3-none-any.whl
wget https://openfly.oss-cn-shanghai.aliyuncs.com/python/redis/redis-4.3.4-py3-none-any.whl

python3 -m pip install /tmp/python/pyparsing-3.1.2-py3-none-any.whl
python3 -m pip install /tmp/python/wrapt-1.16.0-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
python3 -m pip install /tmp/python/typing_extensions-4.1.1-py3-none-any.whl
python3 -m pip install /tmp/python/async_timeout-4.0.2-py3-none-any.whl 
python3 -m pip install /tmp/python/Deprecated-1.2.14-py2.py3-none-any.whl
python3 -m pip install /tmp/python/packaging-21.3-py3-none-any.whl
python3 -m pip install /tmp/python/zipp-3.6.0-py3-none-any.whl
python3 -m pip install /tmp/python/importlib_metadata-4.8.3-py3-none-any.whl
python3 -m pip install /tmp/python/redis-4.3.4-py3-none-any.whl
离线安装模块pymysql
python3 -m pip uninstall pymysql
python3 -m pip install pymysql
#  http://mirrors.cloud.aliyuncs.com/pypi/packages/4f/52/a115fe175028b058df353c5a3d5290b71514a83f67078a6482cff24d6137/PyMySQL-1.0.2-py3-none-any.whl
wget https://mirrors.aliyun.com/pypi/packages/4f/52/a115fe175028b058df353c5a3d5290b71514a83f67078a6482cff24d6137/PyMySQL-1.0.2-py3-none-any.whl
python3 -m pip install /tmp/python/PyMySQL-1.0.2-py3-none-any.whl
升级python
sudo yum groupinstall "Development Tools" -y
sudo yum install openssl-devel bzip2-devel tk-devel xz-devel ncurses-devel sqlite-devel readline-devel libffi-devel zlib-devel -y

cd /tmp
wget https://mirrors.huaweicloud.com/python/3.9.16/Python-3.9.16.tgz

tar xzf Python-3.9.16.tgz
cd Python-3.9.16
# sudo yum install openssl-devel
./configure --enable-optimizations --with-ssl
make -j $(nproc)
make altinstall

python3.9 --version
which python3.9
sudo update-alternatives --install /usr/bin/python3 python3 /usr/local/bin/python3.9 1
sudo update-alternatives --config python3

python3 --version
Error importing huggingface_hub.hf_api: urllib3 v2 only supports OpenSSL 1.1.1+, currently the 'ssl' module is compiled with 'OpenSSL 1.0.2k-fips  26 Jan 2017'. See: https://github.com/urllib3/urllib3/issues/2168
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/local/lib/python3.9/site-packages/transformers/__init__.py", line 27, in <module>
    from . import dependency_versions_check
  File "/usr/local/lib/python3.9/site-packages/transformers/dependency_versions_check.py", line 16, in <module>
    from .utils.versions import require_version, require_version_core
  File "/usr/local/lib/python3.9/site-packages/transformers/utils/__init__.py", line 19, in <module>
    from huggingface_hub import get_full_repo_name  # for backward compatibility
  File "/usr/local/lib/python3.9/site-packages/huggingface_hub/__init__.py", line 1044, in __getattr__
    submod = importlib.import_module(submod_path)
  File "/usr/local/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/usr/local/lib/python3.9/site-packages/huggingface_hub/hf_api.py", line 50, in <module>
    import requests
  File "/usr/local/lib/python3.9/site-packages/requests/__init__.py", line 43, in <module>
    import urllib3
  File "/usr/local/lib/python3.9/site-packages/urllib3/__init__.py", line 42, in <module>
    raise ImportError(
ImportError: urllib3 v2 only supports OpenSSL 1.1.1+, currently the 'ssl' module is compiled with 'OpenSSL 1.0.2k-fips  26 Jan 2017'. See: https://github.com/urllib3/urllib3/issues/2168
pip3 install 'urllib3<2'

python 离线安装python环境
https://ispong.isxcode.com/pytorch/python/python 离线安装python环境/
Author
ispong
Posted on
July 1, 2024
Licensed under