久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

Python 包管理器和 Node.js

Python package managers and Node.js(Python 包管理器和 Node.js)
本文介紹了Python 包管理器和 Node.js的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

問題描述

我正在嘗試使用 Node.js 編譯 python 腳本.python 腳本包括我安裝的一些模塊.我的 python 包管理器是 Anaconda,所以我嘗試提供 {"shell":"path to anaconda prompt"} 選項:

I am trying to compile python scripts using Node.js. The python scripts include some modules I have installed. My package manager for python is Anaconda, so I tried to supply the {"shell":"path to anaconda prompt"} option in :

var exec = require('child_process').exec;
exec('python hello.py',{"shell":"path to anaconda prompt"}, ..callback)

但是,我收到一個錯誤:

However, I get an error:

{ Error: spawn C:UsersdreamAppDataRoamingMicrosoftWindowsStart MenuProgramsAnaconda3 (64-bit)Anaconda Prompt (Anaconda3) ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:232:19)
    at onErrorNT (internal/child_process.js:407:16)
    at process._tickCallback (internal/process/next_tick.js:63:19)
    at Function.Module.runMain (internal/modules/cjs/loader.js:744:11)
    at startup (internal/bootstrap/node.js:285:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:739:3)
  errno: 'ENOENT',
  code: 'ENOENT',
  syscall:
   'spawn C:\Users\dream\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Anaconda3 (64-bit)\Anaconda Prompt (Anaconda3)',
  path:
   'C:\Users\dream\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Anaconda3 (64-bit)\Anaconda Prompt (Anaconda3)',
  spawnargs: [ '/d', '/s', '/c', '"python hello.py"' ],
  cmd: 'python hello.py' }
stdout:

stderr:

我懷疑這是因為 Anaconda Prompt 只是一些奇怪的快捷方式,它為 cmd.exe 設(shè)置了一些變量(這是快捷方式指向的位置).

I suspect that this is because the Anaconda Prompt is just some wierd shortcut that sets up some variables for cmd.exe (which is the location the shortcut points to).

所以我的問題:

我可以直接用 Node.js 調(diào)用 anaconda 提示符嗎?pip 也有殼嗎?

Can I call the anaconda prompt directly with Node.js? Does pip also have a shell?

打包程序(pip、anaconda)如何使 python 可以訪問模塊?-> 這是通過一些環(huán)境變量嗎?

How do the packagers (pip,anaconda) make modules accessible to python? -> Is this through some environment variables?

我可以像他們一樣準(zhǔn)備 cmd.exe 來使用 python 嗎?

Can I prepare cmd.exe for work with python the same way that they do?

推薦答案

我懷疑這是因為 Anaconda Prompt 只是一些奇怪的快捷方式,它為 cmd.exe 設(shè)置了一些變量

是的,差不多就是這樣.所以,不,我不認(rèn)為你可以按照建議來稱呼它.可能有一種方法可以手動操作 cmd.exe 以使其像 Anaconda Prompt 會話一樣運行,但我建議嘗試...

Yes, that's pretty much it. So, no I don't think you can call it as proposed. There is probably a way to manipulate the cmd.exe manually to get it running like an Anaconda Prompt session, but instead I'd propose to try...

不確定這是否適用于 Windows,但可以使用 conda run 在 Conda 環(huán)境中執(zhí)行.這是在 Conda v4.6 中作為實驗性功能引入(并且仍然保留)的,其明確目的是使人們能夠在 Conda 環(huán)境中運行某些東西而無需以交互方式激活它.

Not sure if this will work in Windows, but it might be possible to use conda run to execute within the Conda environment. This was introduced (and still remains) as an experimental feature in Conda v4.6, with the express purpose of enabling one to run something inside a Conda environment without interactively having to activate it.

首先,您可能應(yīng)該測試 conda run 在 Windows 上的工作.假設(shè)您的 conda.exe 位于

First, you should probably test that conda run works on Windows. Let's assume your conda.exe is located at

C:UsersdreamAnaconda3Scriptsconda.exe

啟動一個干凈的 cmd.exe 會話,其中 conda 未定義(即不是 Anaconda Prompt).然后嘗試類似

Start a clean cmd.exe session, where conda is undefined (i.e., not Anaconda Prompt). Then try things like

C:UsersdreamAnaconda3Scriptsconda.exe run where python

或者,如果你有另一個環(huán)境,說 my_env 你也可以這樣做

or, if you have another env, say my_env you can also do

C:UsersdreamAnaconda3Scriptsconda.exe run -n my_env where python

驗證運行的 Python 解釋器是指定的.

to verify that the Python interpreter that gets run is the one specified.

如果上述方法有效,那么您應(yīng)該能夠執(zhí)行類似的操作

If the above works, then you should be able to do something like

var exec = require('child_process').exec;
exec('C:UsersdreamAnaconda3Scriptsconda.exe run python hello.py', ..callback)

不確定在這種情況下是否需要指定的 shell.

Not sure if you'll need the shell specified in this case.

這篇關(guān)于Python 包管理器和 Node.js的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

Troubles while parsing with python very large xml file(使用 python 解析非常大的 xml 文件時出現(xiàn)問題)
Find all nodes by attribute in XML using Python 2(使用 Python 2 在 XML 中按屬性查找所有節(jié)點)
Python - How to parse xml response and store a elements value in a variable?(Python - 如何解析 xml 響應(yīng)并將元素值存儲在變量中?)
How to get XML tag value in Python(如何在 Python 中獲取 XML 標(biāo)記值)
How to correctly parse utf-8 xml with ElementTree?(如何使用 ElementTree 正確解析 utf-8 xml?)
Parse XML from URL into python object(將 XML 從 URL 解析為 python 對象)
主站蜘蛛池模板: 日韩成人在线免费观看 | 超碰免费在线 | 欧美精品久久久久 | 在线观看国产www | 狠狠的干狠狠的操 | 亚洲成人精品一区 | 亚洲啪啪 | 日本不卡在线视频 | 毛片久久久| 国产精品乱码一区二区三区 | 久久精品青青大伊人av | 一区二区高清不卡 | 99久久电影 | 国产激情91久久精品导航 | 午夜一级黄色片 | 亚洲国产成人久久综合一区,久久久国产99 | www.日韩系列 | 日韩专区中文字幕 | 精品三级在线观看 | 毛片网站免费观看 | 美女黄视频网站 | 久久99久久98精品免观看软件 | 久久乐国产精品 | 国产专区在线 | 亚洲一区二区中文字幕 | 中文字幕乱码一区二区三区 | 黄色日批视频 | 亚洲一区二区三区视频 | 亚洲视频一区二区三区 | 日韩中文视频 | 日韩欧美在线视频 | 国内精品久久久久久影视8 最新黄色在线观看 | 国产精品99久久久久久www | 国产91一区二区三区 | 亚洲精品一区二区三区蜜桃久 | 日韩一二三区视频 | 国产1页| 国产激情三区 | 成人福利在线视频 | 日韩精品 电影一区 亚洲 | 日韩毛片在线观看 |