【问题标题】:Python not found as dependency during ' npm jsbin' installation. What is missing?在“npm jsbin”安装期间找不到 Python 作为依赖项。什么不见​​了?
【发布时间】:2013-11-14 21:35:32
【问题描述】:

这个问题是由我在尝试本地安装 jsbin 时遇到的问题创建的。 JGallardo 要求我从中创建一个问题,因为最初我在 original Q&A 中发布了 cmets(请点击链接查看它的内容)。

更新:由于审阅者删除了 Windows 标记,请注意,我在 Windows 7 机器上遇到了问题。

npm install jsbin 命令对我不起作用 - 它会引发我不明白的错误: "npm ERR! Error: getaddrinfo EAGAIN npm ERR! at errnoException (dns.js:37:11) npm ERR! at Object.onanswer [as oncomplete] (dns.js:124:16)"

我已经设置了一个代理服务器,我发现这是我的情况所必需的: npm config set proxy=http://servername:port。 现在它正在获取文件,当我调用 npm install jsbin 进入 "c:\users\myuser\AppData\Roaming\npm-cache" 目录 - 但它运行时间很长。现在它说"can't find python executable" - 你知道这是哪个依赖吗?如果需要,我该如何安装 python 包?

得到上述错误后,我也尝试在运行npn install jsbin之前安装npn install python。它也没有工作,我仍然收到错误 "Error: Can't find Python executable "python", you can set the PYTHON env variable."

你能帮忙在本地安装 jsbin 吗?为什么 npm 找不到 python 包,虽然它似乎已安装?

注意我现在还安装了来自 official source 的官方 Python 解释器,并通过 path 环境变量验证了它是否可用:

Your environment has been set up for using Node.js 0.10.12 (x64) and npm.

C:\>python
Python 3.3.2 (v3.3.2:d047928ae3f6, May 16 2013, 00:06:53) [MSC v.1600 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>

另外,我将PYTHON环境变量设置为安装python系统的路径C:\Python33

我得到的错误是:

gyp ERR! configure error
gyp ERR! stack Error: spawn ENOENT
gyp ERR! stack     at errnoException (child_process.js:980:11)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:771:34)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "node" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Python33\node_modules\jsbin\node_modules\bcrypt
gyp ERR! node -v v0.10.12
gyp ERR! node-gyp -v v0.10.0
gyp ERR! not ok

【问题讨论】:

  • 我不得不问,我很抱歉。 python.exe 在你的系统路径上吗?
  • @K.Niemczyk - 好问题! npm install python下载一个在 npm-cache 中创建的 python 包。在C:\Users\...\npm-cache\python\0.0.2\package\lib 中有一个python.js 文件,但没有python.exe。我不知道这个 lib 的用途,但是对于一个完整的 python 解释器来说,它似乎太小了。
  • 我建议手动将 python 解释器的路径放在你的 sys 路径上,然后重试。有时回想起来,这些事情都是令人头疼的。
  • @K.Niemczyk:我已经更新了我的问题 - Python 已安装,在路径中可用,但问题仍然存在。
  • 嗯:咨询过this的问题吗?听起来像一个类似的问题。

标签: python npm jsbin


【解决方案1】:

我不知道为什么 NPN 没有安装 python,但后来我尝试了另一个安装程序,choco (or Chocolatey),它成功了。

步骤是:

  1. 安装 Chocolatey。有关说明,请参阅Chocolatey website
  2. 打开管理员控制台,然后执行以下操作:

C:\WINDOWS\system32>choco install python

!!ATTENTION!!
The next version of Chocolatey (v0.9.9) will require -y to perform
  behaviors that change state without prompting for confirmation. Start
  using it now in your automated scripts.

  For details on the all new Chocolatey, visit http://bit.ly/new_choco
Chocolatey (v0.9.8.33) is installing 'python' and dependencies. 
By installing you accept the license for 'python' and each dependency you are installing.

python v3.4.3
Using this proxyserver: defrceprx02.ey.net:8443
Downloading python 64 bit
  from 'https://www.python.org/ftp/python/3.4.3/python-3.4.3.amd64.msi'
Using this proxyserver: defrceprx02.ey.net:8443
Installing python...
python has been installed.
python has finished successfully! The chocolatey gods have answered your request!
PATH environment variable does not have C:\tools\python in it. Adding...
Finished installing 'python' and dependencies - if errors not shown in console, none detected. 
Check log for errors if unsure.

C:\WINDOWS\system32>

【讨论】:

    猜你喜欢
    • 2021-08-28
    • 1970-01-01
    • 1970-01-01
    • 2015-11-15
    • 1970-01-01
    • 2019-10-28
    • 2013-08-26
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多