Erpnext安装
环境要求
Ubuntu 23.04 x86_64
Python 3.10.12
pip 23.0.1
node v18.16.0
npm 9.5.1
yarn 1.22.22
MariaDB 10.11.2
Redis 7.0.8
wkhtmltox 0.12.6.1
bench 5.22.6
环境安装
Reids
安装
// 安装7.0.8 也可不指定版本 直接执行 sudo apt install redis-server
sudo apt install redis-server=5:7.0.8-4
// 检查安装的版本
redis-server --version
// 配置 apt 保持特定版本
// 安装后保持该特定版本而不自动升级,可以将该包保持在当前版本
sudo apt-mark hold redis-server
MariaDB
安装
// 安装 也可不指定版本 直接执行 sudo apt install mariadb-server
sudo apt install mariadb-server=1:10.11.2-1
// 在此安装过程中,系统将提示您设置 MySQL root 密码。如果未出现提示,则必须自行初始化MySQL服务器设置。您可以通过运行以下命令来执行此操作
// 请记住:只有在安装过程中未提示您输入密码时才运行它。
mysql_secure_installation
//
sudo apt-get install mariadb-client-10.3
// 现在,编辑 MariaDB 配置文件。
vim /etc/mysql/my.cnf
// 并添加此配置
[mysqld]
character-set-client-handshake = FALSE
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci
[mysql]
default-character-set = utf8mb4
// 现在,只需重新启动mysql服务,就可以开始了。
service mysql restart
// 查看版本
mysql --version
// 固定版本
sudo apt-mark hold mariadb-server
Node
下载安装包v18.16.0
https://nodejs.org/dist/v18.16.0/
wget -c https://nodejs.org/dist/v18.16.0/node-v18.16.0-linux-x64.tar.gz
tar -xvf node-v18.16.0-linux-x64.tar.gz
mv node-v18.16.0-linux-x64 /usr/local/nodejs
// 创建软连接
ln -s /usr/local/nodejs/bin/node /usr/local/bin/node
ln -s /usr/local/nodejs/bin/npm /usr/local/bin/npm
// 编辑环境变量
vim /etc/profile
export NODE_HOME=/usr/local/nodejs/
export PATH=$NODE_HOME/bin:$PATH
// 使环境变量生效
source /etc/profile
// 验证
node -v
npm -v
Yarn
1.22.22
npm install -g yarn@1.22.22
wkhtmltox
打开
https://wkhtmltopdf.org/downloads.html
下载
// 从 https://wkhtmltopdf.org/downloads.html 下载并安装 wkhtmltopdf 包
apt-get install xvfb libfontconfig
// 安装
dpkg -i wkhtmltox_0.12.6.1-2.jammy_amd64.deb
// 可能遇到缺少xfonts-75dpi
sudo apt-get install -y xfonts-75dpi
// 再次尝试安装 wkhtmltox 包
sudo dpkg -i wkhtmltox_0.12.6.1-2.jammy_amd64.deb
Python
安装3.10.12
// 检查
python3 --version // Python 3.10.12
// 如果不是3.10.12 再进行安装
// 安装pyenv
sudo apt update
sudo apt install -y make build-essential libssl-dev zlib1g-dev \
libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm \
libncurses5-dev libncursesw5-dev xz-utils tk-dev \
libffi-dev liblzma-dev python-openssl git
// 使用 curl 来安装 pyenv
curl https://pyenv.run | bash
// 在 ~/.bashrc 或 ~/.zshrc 文件中添加以下内容:
export PATH="$HOME/.pyenv/bin:$PATH"
eval "$(pyenv init --path)"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
// 重新加载 shell 配置文件
source ~/.bashrc # 如果使用 bash
source ~/.zshrc # 如果使用 zsh
// 使用 pyenv 安装指定版本的 Python
pyenv install 3.10.12
// 设置全局 Python 版本
pyenv global 3.10.12
// 验证当前 Python 版本
python --version
bench
安装5.22.6 bench
pip3 install frappe-bench==5.22.6
// 验证
bench --version
安装项目
-
在合适的目录下
bench init --version frappe-erpnext
-
初始化站点
bench new-site erpnext.server.app
-
下载erpnext
bench get-app https://github.com/frappe/payments.git
bench get-app --branch v14.70.2 https://github.com/frappe/erpnext.git
bench get-app --branch v15.21.2 https://github.com/frappe/hrms.git
// 汉化
bench get-app --branch version-14 https://gitee.com/phipsoft/zh_chinese_language.git -
安装erpnext
bench --site erpnext.server.app install-app payments
bench --site erpnext.server.app install-app erpnext
bench --site erpnext.server.app install-app hrms
bench --site erpnext.server.app install-app zh_chinese_language -
启动项目
bench start
常见问题
新版ubuntu使用pip时发生错误
error: externally-managed-environment
× This environment is externally managed
╰─> To install Python packages system-wide, try apt install
python3-xyz, where xyz is the package you are trying to
install.
If you wish to install a non-Debian-packaged Python package,
create a virtual environment using python3 -m venv path/to/venv.
Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
sure you have python3-full installed.
If you wish to install a non-Debian packaged Python application,
it may be easiest to use pipx install xyz, which will manage a
virtual environment for you. Make sure you have pipx installed.
See /usr/share/doc/python3.11/README.venv for more information.
解决方案:如果你习惯于原来的用法可以强制删除此警告
sudo mv /usr/lib/python3.x/EXTERNALLY-MANAGED /usr/lib/python3.x/EXTERNALLY-MANAGED.bak
安装时不能使用root权限
root@molang-System-Product-Name:~/workspace$ bench init frappe-bench
WARN: You should not run this command as root
解决方案: 切换到普通用户
su molang
当前用户权限不够
molang@molang-System-Product-Name:~/workspace$ bench init frappe-bench
Traceback (most recent call last):
File "/usr/local/lib/python3.11/dist-packages/bench/commands/make.py", line 75, in init
init(
File "/usr/local/lib/python3.11/dist-packages/bench/utils/render.py", line 105, in wrapper_fn
return fn(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/bench/utils/system.py", line 64, in init
bench.setup.dirs()
File "/usr/local/lib/python3.11/dist-packages/bench/utils/render.py", line 126, in wrapper_fn
return fn(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/bench/bench.py", line 338, in dirs
os.makedirs(self.bench.name, exist_ok=True)
File "<frozen os>", line 225, in makedirs
PermissionError: [Errno 13] Permission denied: 'frappe-bench'
ERROR: There was a problem while creating frappe-bench
Do you want to rollback these changes? [y/N]: y
INFO: Rolling back Bench "frappe-bench"
解决方案:增加权限
sudo chmod 777 .
找不到yarn命令
执行bench init frappe-bench时报错找不到yarn
molang@molang-System-Product-Name:~/workspace$ bench init frappe-bench
Setting Up Environment
$ python3 -m venv env
$ /home/molang/workspace/frappe-bench/env/bin/python -m pip install --quiet --upgrade pip
$ /home/molang/workspace/frappe-bench/env/bin/python -m pip install --quiet wheel
Getting frappe
$ git clone https://github.com/frappe/frappe.git --depth 1 --origin upstream
正克隆到 'frappe'...
remote: Enumerating objects: 3226, done.
remote: Counting objects: 100% (3226/3226), done.
remote: Compressing objects: 100% (2837/2837), done.
remote: Total 3226 (delta 431), reused 1598 (delta 275), pack-reused 0
接收对象中: 100% (3226/3226), 11.05 MiB | 11.13 MiB/s, 完成.
处理 delta 中: 100% (431/431), 完成.
Installing frappe
$ /home/molang/workspace/frappe-bench/env/bin/python -m pip install --quiet --upgrade -e /home/molang/workspace/frappe-bench/apps/frappe
$ yarn install --check-files
Traceback (most recent call last):
File "/usr/local/lib/python3.11/dist-packages/bench/commands/make.py", line 75, in init
init(
File "/usr/local/lib/python3.11/dist-packages/bench/utils/render.py", line 105, in wrapper_fn
return fn(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/bench/utils/system.py", line 87, in init
get_app(
File "/usr/local/lib/python3.11/dist-packages/bench/app.py", line 772, in get_app
app.install(verbose=verbose, skip_assets=skip_assets, restart_bench=restart_bench)
File "/usr/local/lib/python3.11/dist-packages/bench/utils/render.py", line 126, in wrapper_fn
return fn(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/bench/app.py", line 255, in install
install_app(
File "/usr/local/lib/python3.11/dist-packages/bench/app.py", line 915, in install_app
bench.run(yarn_install, cwd=app_path)
File "/usr/local/lib/python3.11/dist-packages/bench/bench.py", line 48, in run
return exec_cmd(cmd, cwd=cwd or self.cwd, _raise=_raise)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/bench/utils/__init__.py", line 165, in exec_cmd
return_code = subprocess.call(spl_cmd, cwd=cwd, universal_newlines=True, env=env)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/subprocess.py", line 389, in call
with Popen(*popenargs, **kwargs) as p:
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/subprocess.py", line 1026, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "/usr/lib/python3.11/subprocess.py", line 1950, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
PermissionError: [Errno 13] Permission denied: 'yarn'
ERROR: There was a problem while creating frappe-bench
Do you want to rollback these changes? [y/N]: y
INFO: Rolling back Bench "frappe-bench"
molang@molang-System-Product-Name:~/workspace$ yarn --version
找不到命令 “yarn”,但可以通过以下软件包安装它:
sudo apt install cmdtest
解决方案
-
安装yarn后如果再次出现找不到yarn的问题
molang@molang-System-Product-Name:~/workspace$ npm install -g yarn
changed 1 package, and audited 2 packages in 1s
found 0 vulnerabilitie
molang@molang-System-Product-Name:~/workspace$ yarn --version
找不到命令 “yarn”,但可以通过以下软件包安装它:
sudo apt install cmdtest -
将yarn手动配置到Path环境变量中
找到yarn地址
molang@molang-System-Product-Name:~/workspace$ npm bin -g
/home/node/node-v18.12.1-linux-x64/bin
打开你的终端配置文件(通常是 **~/.bashrc**
、**~/.bash_profile**
或 **~/.profile**
),然后将 **yarn**
的安装路径添加到 PATH 变量中。
在文件的末尾添加以下行:
export PATH="$PATH:/home/node/node-v18.12.1-linux-x64/bin"
刷新配置
molang@molang-System-Product-Name:~/workspace$ source ~/.bashrc
molang@molang-System-Product-Name:~/workspace$ yarn --version
1.22.21
代理问题
User
molang@molang-System-Product-Name:~/workspace/frappe-erpnext$ bench get-app hrms
A directory for the application 'hrms' already exists. Do you want to continue and overwrite it? [y/N]: y
INFO: App moved from apps/hrms to archived/apps/hrms-2024-04-02_2
Getting hrms
$ git clone https://github.com/frappe/hrms.git --branch develop --depth 1 --origin upstream
正克隆到 'hrms'...
remote: Enumerating objects: 1513, done.
remote: Counting objects: 100% (1513/1513), done.
remote: Compressing objects: 100% (1145/1145), done.
remote: Total 1513 (delta 410), reused 994 (delta 302), pack-reused 0
接收对象中: 100% (1513/1513), 7.86 MiB | 3.24 MiB/s, 完成.
处理 delta 中: 100% (410/410), 完成.
Ignoring dependencies of hrms. To install dependencies use --resolve-deps
Installing hrms
$ /home/molang/workspace/frappe-erpnext/env/bin/python -m pip install --quiet --upgrade -e /home/molang/workspace/frappe-erpnext/apps/hrms
error: subprocess-exited-with-error
× pip subprocess to install build dependencies did not run successfully.
│ exit code: 1
╰─> [2 lines of output]
ERROR: Could not install packages due to an OSError: Missing dependencies for SOCKS support.
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error
× pip subprocess to install build dependencies did not run successfully.
│ exit code: 1
╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: /home/molang/workspace/frappe-erpnext/env/bin/python -m pip install --quiet --upgrade -e /home/molang/workspace/frappe-erpnext/apps/hrms
subprocess.CalledProcessError: Command '/home/molang/workspace/frappe-erpnext/env/bin/python -m pip install --quiet --upgrade -e /home/molang/workspace/frappe-erpnext/apps/hrms ' returned non-zero exit status 1.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/local/bin/bench", line 8, in <module>
sys.exit(cli())
代理问题导致SOCKSp不可用 最后就会显示ython -m pip install --quiet --upgrade -e 不可用
如果因为梯子导致pip intstall报错 ValueError: Unable to determine SOCKS version from socks://127.0.0.1:1080 问题
解决办法就是重置代理就ok
unset all_proxy
unset ALL_PROXY
没有虚拟环境
molang@AY130628150444Z:~$ bench init frappe-erpnext
Setting Up Environment
$ python3 -m venv env
The virtual environment was not created successfully because ensurepip is not
available. On Debian/Ubuntu systems, you need to install the python3-venv
package using the following command.
apt install python3.10-venv
You may need to use sudo with that command. After installing the python3-venv
package, recreate your virtual environment.
Failing command: /home/molang/frappe-erpnext/env/bin/python3
subprocess.CalledProcessError: Command 'python3 -m venv env' returned non-zero exit status 1.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/local/lib/python3.10/dist-packages/bench/commands/make.py", line 75, in init
init(
File "/usr/local/lib/python3.10/dist-packages/bench/utils/render.py", line 105, in wrapper_fn
return fn(*args, **kwargs)
File "/usr/local/lib/python3.10/dist-packages/bench/utils/system.py", line 66, in init
bench.setup.env(python=python)
File "/usr/local/lib/python3.10/dist-packages/bench/utils/render.py", line 126, in wrapper_fn
return fn(*args, **kwargs)
File "/usr/local/lib/python3.10/dist-packages/bench/bench.py", line 362, in env
self.run(f"{venv} env", cwd=self.bench.name)
File "/usr/local/lib/python3.10/dist-packages/bench/bench.py", line 48, in run
return exec_cmd(cmd, cwd=cwd or self.cwd, _raise=_raise)
File "/usr/local/lib/python3.10/dist-packages/bench/utils/__init__.py", line 169, in exec_cmd
raise CommandFailedError(cmd) from subprocess.CalledProcessError(return_code, cmd)
bench.exceptions.CommandFailedError: python3 -m venv env
ERROR: There was a problem while creating frappe-erpnext
安装虚拟环境
apt install python3.10-venv
无法安装虚拟环境
root@AY130628150444Z:/home/molang# apt install python3.10-venv
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
python3.10-venv : Depends: python3-pip-whl but it is not going to be installed
Depends: python3-setuptools-whl but it is not going to be installed
wkhtmltox : Depends: fontconfig but it is not going to be installed
Depends: libxrender1 but it is not going to be installed
Depends: xfonts-75dpi but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
看起来你遇到了依赖问题,导致无法安装 **python3.10-venv**
包。这可能是因为某些依赖包没有正确安装或者版本不兼容所致。
你可以尝试运行 **apt --fix-broken install**
命令来修复未满足的依赖关系,它会尝试自动解决依赖问题。
apt --fix-broken install
运行这个命令后,系统会尝试自动安装缺失的依赖项,并解决任何存在的依赖关系问题。
一旦修复了依赖关系问题,你就可以再次尝试安装 **python3.10-venv**
包。
apt install python3.10-venv
如果问题仍然存在,可能需要更深入地检查依赖关系,确保所有的依赖项都正确安装并且与系统兼容。
Exception: No process manager found
command bench start cause error:
Traceback (most recent call last):
File "/usr/local/bin/bench", line 9, in
load_entry_point('bench==0.1', 'console_scripts', 'bench')()
File "/home/fourmax/bench/bench/cli.py", line 24, in cli
return bench()
File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 488, in call
return self.main(_args, *_kwargs)
File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 474, in main
self.invoke(ctx)
File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 758, in invoke
return self.invoke_subcommand(ctx, cmd, cmd_name, ctx.args[1:])
File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 767, in invoke_subcommand
return cmd.invoke(cmd_ctx)
File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 659, in invoke
ctx.invoke(self.callback, *_ctx.params)
File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 325, in invoke
return callback(_args, **kwargs)
File "/home/fourmax/bench/bench/cli.py", line 97, in start
_start()
File "/home/fourmax/bench/bench/utils.py", line 157, in start
raise Exception("No process manager found")
Exception: No process manager found
解决
You can install it using sudo pip install honcho
Redis端口占用
替补启动
14:50:10系统| redis_socketio.1 已启动 (pid=19224)
14:50:10 系统 | redis_cache.1 已启动 (pid=19220)
14:50:10 系统 | redis_queue.1 已启动 (pid=19229)
14:50:10 redis_cache.1 | 19223:C 2023 年 9 月 1 日 14:50:10.077 # oO0OoO0OoO0Oo Redis 正在启动 oO0OoO0OoO0Oo
14:50:10 redis_cache.1 | 19223:C 19223:C 19223:C 2023年9月1日 14:50:10.078 # Redis 版本=6.0.16,位=64,提交=00000000,修改=0,pid=19223,刚刚开始
14:50:10 redis_cache. 1 | 19223:C 19223:C 2023 年 9 月 1 日 14:50:10.078 # 配置已加载
14:50:10 redis_cache.1 | 19223:M 2023 年 9 月 1 日 14:50:10.078 * 将打开文件的最大数量增加到 10032(最初设置为 1024)。
14:50:10 redis_cache.1 | 19223:M 19223:M 19223:M 2023 年 9 月 1 日 14:50:10.078 # 无法创建 TCP 监听设备 127.0.0.1:13000:bind:地址已在使用中
14:50:10 redis_queue.1 | 19223:M 19223:M 19223:M 2023 年 9 月 1 日 14:50:10.078 19231:C 2023 年 9 月 1 日 14:50:10.078 # oO0OoO0OoO0Oo Redis 正在启动 oO0OoO0OoO0Oo
14:50:10 redis_queue.1 | 19231:C 19231:C 2023年9月1日14:50:10.078 # Redis版本=6.0.16,位=64,提交=00000000,修改=0,pid=19231,刚刚开始
14:50:10 redis_queue. 1 | 19231:C 19231:C 2023 年 9 月 1 日 14:50:10.078 # 配置已加载
14:50:10 redis_queue.1 | 19231:M 2023
年9月1日 14:50:10.079 * 将打开文件的最大数量增加到10032(最初设置为1024)。redis_cache.1 已停止 (rc=1)
14:50:10 redis_queue.1 | 19231:M 2023年9月1日 14:50:10.079 * 将打开文件的最大数量增加到10032(最初设置为1024)。 19231:M 2023 年 9 月 01 日 14:50:10.082 # 创建无法使用 TCP 监听设备 127.0.0.1:11000:bind:地址已在使用
14:50:10 系统 | 19231:M 19231:M 2023 年 9 月 01 日 14:50:10.082 redis_queue.1 已停止 (rc=1)
14:50:10 系统 | web.1 启动 (pid=19242)
14:50:10 系统 | web.1 启动 (pid=19242) 14:50:10 web.1 启动 (pid=19242) 14:50:10 Schedule.1 已启动 (pid=19238)
14:50:10 系统 | web.1 已启动 (pid=19238) 14:50:10 worker_long.1 启动 (pid=19240)
14:50:10 系统 | worker_short.1 启动 (pid=19241)
14:50:10 系统 | watch.1 启动 (pid=19235)
14:50:10 redis_socketio.1 | 19227:C 2023 年 9 月 1 日 14:50:10.090 # oO0OoO0OoO0Oo Redis 正在启动 oO0OoO0OoO0Oo
14:50:10 redis_socketio.1 | 19227:C 2023 年 9 月 1 日 14:50:10.091 # Redis 版本=6.0.16,位=64,提交=00000000,修改=0,pid=19227,刚刚开始
14:50:10 redis_socketio.1 | 19227:C 19227:C 19227:C 2023 年 9 月 1 日 14:50:10.091 # 配置已加载
14:50:10 redis_socketio.1 | 19227:M 2023 年 9 月 1 日 14:50:10.092 * 将打开文件的最大数量增加到 10032(最初设置为 1024)。
14:50:10 redis_socketio.1 | 19227:M 19227:M 19227:M 2023 年 9 月 1 日 14:50:10.093 # 无法创建 TCP 监听插件 127.0.0.1:12000:bind:已在使用
14:50:10 系统 | 19227:M 19227:M 19227:M 2023 年 9 月 1 日 14:50:10.093 redis_socketio.1 已停止 (rc=1)
14:50:10 系统 | socketio.1 已启动(pid=19239)
14:50:10 系统 | worker_default.1 已启动(pid=19244)
14:50:10 系统 | 向 web.1(pid 19242)发送 SIGTERM
14:50:10 系统 | 向socketio.1(pid 19239)发送SIGTERM
14:50:10 系统 | 向 watch.1(pid 19235)发送 SIGTERM
14:50:10 系统 | 向schedule.1(pid 19238)发送SIGTERM
14:50:10 系统 | 向worker_short.1(pid 19241)发送SIGTERM
14:50:10 系统 | 向worker_long.1(pid 19240)发送SIGTERM
14:50:10 系统 |向worker_default.1 (pid 19244) 发送SIGTERM
14:50:10 系统| socketio.1 已停止(rc=-15)
14:50:10 系统 | Schedule.1 已停止(rc=-15)
14:50:10 系统 | worker_short.1 已停止(rc=-15)
14:50:10 系统 | web.1 已停止(rc=-15)
14:50:10 系统 | worker_long.1 已停止(rc=-15)
14:50:10 系统 | worker_default.1 已停止(rc=-15)
14:50:10 系统 | watch.1 已停止(rc=-15)
解决
bench init --skip-redis-config-generation frappe-bench
注意:在工作台初始化期间使用选项“–skip-redis-config- Generation”,不再需要这些操作。但至少,看看 ProcFile 看看在启动命令上启动 honcho 时发生了什么
Honcho 是 Bench 用来管理 Frappe 所需的所有流程的工具。通常,这些都在本地主机中运行,但在这种情况下,我们有 Redis 的外部容器。因此,我们必须阻止 Honcho 尝试启动 Redis 进程。
官方文档:https://github.com/frappe/frappe_docker/blob/main/docs/development.md#edit-honchos-procfile
没有Git
www@erp:/opt$ /usr/local/bin/bench --version
Traceback (most recent call last):
File "/home/www/.local/lib/python3.10/site-packages/git/__init__.py", line 296, in <module>
refresh()
File "/home/www/.local/lib/python3.10/site-packages/git/__init__.py", line 287, in refresh
if not Git.refresh(path=path):
File "/home/www/.local/lib/python3.10/site-packages/git/cmd.py", line 631, in refresh
raise ImportError(err)
ImportError: Bad git executable.
The git executable must be specified in one of the following ways:
- be included in your $PATH
- be set via $GIT_PYTHON_GIT_EXECUTABLE
- explicitly set via git.refresh(<full-path-to-git-executable>)
All git commands will error until this is rectified.
This initial message can be silenced or aggravated in the future by setting the
$GIT_PYTHON_REFRESH environment variable. Use one of the following values:
- quiet|q|silence|s|silent|none|n|0: for no message or exception
- warn|w|warning|log|l|1: for a warning message (logging level CRITICAL, displayed by default)
- error|e|exception|raise|r|2: for a raised exception
Example:
export GIT_PYTHON_REFRESH=quiet
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/local/bin/bench", line 5, in <module>
from bench.cli import cli
File "/usr/local/lib/python3.10/dist-packages/bench/cli.py", line 14, in <module>
from bench.bench import Bench
File "/usr/local/lib/python3.10/dist-packages/bench/bench.py", line 36, in <module>
from bench.utils.app import get_current_version
File "/usr/local/lib/python3.10/dist-packages/bench/utils/app.py", line 17, in <module>
from bench.app import get_repo_dir
File "/usr/local/lib/python3.10/dist-packages/bench/app.py", line 21, in <module>
import git
File "/home/www/.local/lib/python3.10/site-packages/git/__init__.py", line 298, in <module>
raise ImportError("Failed to initialize: {0}".format(_exc)) from _exc
ImportError: Failed to initialize: Bad git executable.
The git executable must be specified in one of the following ways:
- be included in your $PATH
- be set via $GIT_PYTHON_GIT_EXECUTABLE
- explicitly set via git.refresh(<full-path-to-git-executable>)
All git commands will error until this is rectified.
This initial message can be silenced or aggravated in the future by setting the
$GIT_PYTHON_REFRESH environment variable. Use one of the following values:
- quiet|q|silence|s|silent|none|n|0: for no message or exception
- warn|w|warning|log|l|1: for a warning message (logging level CRITICAL, displayed by default)
- error|e|exception|raise|r|2: for a raised exception
Example:
export GIT_PYTHON_REFRESH=quiet
sudo apt install git
没有虚拟环境
www@erp:/opt$ bench init frappe-erpnext
Setting Up Environment
$ python3 -m venv env
The virtual environment was not created successfully because ensurepip is not
available. On Debian/Ubuntu systems, you need to install the python3-venv
package using the following command.
apt install python3.10-venv
You may need to use sudo with that command. After installing the python3-venv
package, recreate your virtual environment.
Failing command: /opt/frappe-erpnext/env/bin/python3
subprocess.CalledProcessError: Command 'python3 -m venv env' returned non-zero exit status 1.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/www/.local/lib/python3.10/site-packages/bench/commands/make.py", line 75, in init
init(
File "/home/www/.local/lib/python3.10/site-packages/bench/utils/render.py", line 105, in wrapper_fn
return fn(*args, **kwargs)
File "/home/www/.local/lib/python3.10/site-packages/bench/utils/system.py", line 66, in init
bench.setup.env(python=python)
File "/home/www/.local/lib/python3.10/site-packages/bench/utils/render.py", line 126, in wrapper_fn
return fn(*args, **kwargs)
File "/home/www/.local/lib/python3.10/site-packages/bench/bench.py", line 362, in env
self.run(f"{venv} env", cwd=self.bench.name)
File "/home/www/.local/lib/python3.10/site-packages/bench/bench.py", line 48, in run
return exec_cmd(cmd, cwd=cwd or self.cwd, _raise=_raise)
File "/home/www/.local/lib/python3.10/site-packages/bench/utils/__init__.py", line 178, in exec_cmd
raise CommandFailedError(cmd) from subprocess.CalledProcessError(return_code, cmd)
bench.exceptions.CommandFailedError: python3 -m venv env
ERROR: There was a problem while creating frappe-erpnext
Do you want to rollback these changes? [y/N]: y
INFO: Rolling back Bench "frappe-erpnext"
sudo apt install python3.10-venv