generator icon indicating copy to clipboard operation
generator copied to clipboard

使用scripts目录 install.sh 脚本,出现 python 版本不对应错误情况

Open userInner opened this issue 1 year ago • 1 comments

直接使用安装脚本

root@tmd:/# cd generator/ && bash ./scripts/install.sh
 Debian*|Ubuntu Platform
正在读取软件包列表... 完成
正在分析软件包的依赖关系树... 完成
正在读取状态信息... 完成                 
curl 已经是最新版 (7.81.0-1ubuntu1.10)。
openssl 已经是最新版 (3.0.2-0ubuntu1.10)。
下列软件包是自动安装的并且现在不需要了:
  javascript-common libjs-jquery libjs-sphinxdoc libjs-underscore libpython3-dev libpython3.10-dev
  python3-dev python3-wheel python3.10-dev zlib1g-dev
使用'sudo apt autoremove'来卸载它(它们)。
推荐安装:
  python2-dev
下列软件包将被【卸载】:
  python3-pip
下列【新】软件包将被安装:
  python-pip
升级了 0 个软件包,新安装了 1 个软件包,要卸载 1 个软件包,有 16 个软件包未被升级。
需要下载 0 B/1,021 kB 的归档。
解压缩后将会空出 2,151 kB 的空间。
(正在读取数据库 ... 系统当前共安装有 222161 个文件和目录。)
正在卸载 python3-pip (22.0.2+dfsg-1ubuntu0.3) ...
正在选中未选择的软件包 python-pip。
(正在读取数据库 ... 系统当前共安装有 221477 个文件和目录。)
准备解压 .../python-pip_20.3.4+dfsg-4_all.deb  ...
正在解压 python-pip (20.3.4+dfsg-4) ...
正在设置 python-pip (20.3.4+dfsg-4) ...
正在处理用于 man-db (2.10.2-1) 的触发器 ...
./scripts/install.sh: 行 129: pip: 未找到命令
./scripts/install.sh: line 130: pip: command not found
python and pip is not same version
python -V, get version => 2
Python 2.7.18
pip -V, get version => not
./scripts/install.sh: line 147: not: command not found

解决方案:https://github.com/FISCO-BCOS/generator/issues/184

再次尝试安装出现:

root@tmd:/generator# bash ./scripts/install.sh
Debian*|Ubuntu Platform
正在读取软件包列表... 完成
正在分析软件包的依赖关系树... 完成
正在读取状态信息... 完成                 
curl 已经是最新版 (7.81.0-1ubuntu1.10)。
openssl 已经是最新版 (3.0.2-0ubuntu1.10)。
下列软件包是自动安装的并且现在不需要了:
 python-pkg-resources python-setuptools
使用'sudo apt autoremove'来卸载它(它们)。
下列软件包将被【卸载】:
 python-pip
下列【新】软件包将被安装:
 python3-pip
升级了 0 个软件包,新安装了 1 个软件包,要卸载 1 个软件包,有 16 个软件包未被升级。
需要下载 1,305 kB 的归档。
解压缩后会消耗 2,151 kB 的额外空间。
获取:1 https://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy-updates/universe amd64 python3-pip all 22.0.2+dfsg-1ubuntu0.3 [1,305 kB]
已下载 1,305 kB,耗时 1秒 (2,523 kB/s)
(正在读取数据库 ... 系统当前共安装有 221978 个文件和目录。)
正在卸载 python-pip (20.3.4+dfsg-4) ...
正在选中未选择的软件包 python3-pip。
(正在读取数据库 ... 系统当前共安装有 221477 个文件和目录。)
准备解压 .../python3-pip_22.0.2+dfsg-1ubuntu0.3_all.deb  ...
正在解压 python3-pip (22.0.2+dfsg-1ubuntu0.3) ...
正在设置 python3-pip (22.0.2+dfsg-1ubuntu0.3) ...
正在处理用于 man-db (2.10.2-1) 的触发器 ...
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting toml
 Downloading https://pypi.tuna.tsinghua.edu.cn/packages/44/6f/7120676b6d73228c96e17f1f794d8ab046fc910d781c8d151120c3f1569e/toml-0.10.2-py2.py3-none-any.whl (16 kB)
Installing collected packages: toml
Successfully installed toml-0.10.2
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Requirement already satisfied: six in /usr/lib/python3/dist-packages (from -r requirements.txt (line 1)) (1.16.0)
Collecting configparser
 Downloading https://pypi.tuna.tsinghua.edu.cn/packages/e0/7a/9d0f52bf4923b2e410c7d6fda472c32d9b728284e89ec99074820226102f/configparser-5.3.0-py3-none-any.whl (19 kB)
Requirement already satisfied: toml in /root/.local/lib/python3.10/site-packages (from -r requirements.txt (line 3)) (0.10.2)
Installing collected packages: configparser
Successfully installed configparser-5.3.0
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
python and pip is not same version
python -V, get version => 2
Python 2.7.18
pip -V, get version => 3
./scripts/install.sh: line 147: 3: command not found

错误主要内容:

python and pip is not same version
python -V, get version => 2
Python 2.7.18
pip -V, get version => 3

解释: 这是版本不对应的问题.

解决方案

1.which python3 ,记录下python3的路径 image 2.这里我们不再使用python,使用的是python3 所以对 python3进行软链接 image

再执行安装脚本

root@tmd:/generator# bash ./scripts/install.sh
 Debian*|Ubuntu Platform
正在读取软件包列表... 完成
正在分析软件包的依赖关系树... 完成
正在读取状态信息... 完成                 
curl 已经是最新版 (7.81.0-1ubuntu1.10)。
openssl 已经是最新版 (3.0.2-0ubuntu1.10)。
python3-pip 已经是最新版 (22.0.2+dfsg-1ubuntu0.3)。
下列软件包是自动安装的并且现在不需要了:
  python-pkg-resources python-setuptools
使用'sudo apt autoremove'来卸载它(它们)。
升级了 0 个软件包,新安装了 0 个软件包,要卸载 0 个软件包,有 16 个软件包未被升级。
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Requirement already satisfied: toml in /root/.local/lib/python3.10/site-packages (0.10.2)
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Requirement already satisfied: six in /usr/lib/python3/dist-packages (from -r requirements.txt (line 1)) (1.16.0)
Requirement already satisfied: configparser in /usr/local/lib/python3.10/dist-packages (from -r requirements.txt (line 2)) (5.3.0)
Requirement already satisfied: toml in /root/.local/lib/python3.10/site-packages (from -r requirements.txt (line 3)) (0.10.2)
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
try to use python3
 install generator successful!

userInner avatar Jul 07 '23 03:07 userInner

ubuntu 22.04 下执行sudo apt install python-is-python3解决上述问题

sheepc avatar Jan 13 '24 07:01 sheepc