gpt4 book ai didi

windows - WP CLI Shell 不适用于 Windows

转载 作者:可可西里 更新时间:2023-11-01 11:47:43 25 4
gpt4 key购买 nike

我最近按照以下说明在 Windows 上安装了 WP-CLI。但是,当我键入 wp shell 时,出现错误:

The system cannot find the path specified.

github 上的一个解决方案说:

Psysh is not bundled in wp-cli.phar, but you should be able to include it, like so:

wget psysh.org/psysh -O psysh.phar php wp-cli.phar --require=psysh.phar shell

但是,这也会产生错误:

'wget' is not recognized as an internal or external command, operable program or batch file.

求助!我离兔子洞太远了。我想使用 WP CLI 让我的生活更轻松!

遵循安装说明(来自 http://wp-cli.org/docs/installing/):

Installing on Windows# Install via composer as described above or use the following method.

Make sure you have php installed and in your path so you can execute it globally.

Download wp-cli.phar manually and save it to a folder, for example c:\wp-cli

Create a file named wp.bat in c:\wp-cli with the following contents:

@ECHO OFF php "c:/wp-cli/wp-cli.phar" %*

Add c:\wp-cli to your path:

setx path "%path%;c:\wp-cli"

You can now use WP-CLI from anywhere in Windows command line

最佳答案

您似乎将通过 Composer 安装 WP-CLI 的说明与手动安装的说明混合在一起。你需要坚持其中一个。我记得按照手动安装说明进行操作,一切顺利。请按照这些说明进行操作。暂时忘掉 Composer。

wget 是一个 Unix 程序,如果不专门安装它就不能在 Windows 上运行。不要将它用于此安装。

听起来您的全局路径中缺少 WP-CLIPHP。按照 http://php.net/manual/en/faq.installation.php#faq.installation.addtopath 上的说明进行操作以确保 PHP 可在全局范围内执行。具体如下:

Go to Control Panel and open the System icon (Start → Control Panel)

Go to the Advanced tab

Click on the 'Environment Variables' button

Look into the 'System Variables' pane

Find the Path entry (you may need to scroll to find it)

Double click on the Path entry

Enter your PHP directory at the end, including ';' before (e.g. ;C:\php)

Press OK

WP-CLI 可执行文件的路径执行相同的操作。结果应该看起来有点像下面我自己的 PATH。

windows path

关于windows - WP CLI Shell 不适用于 Windows,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40279141/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com