首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Python找不到Brownie文件

Python找不到Brownie文件
EN

Stack Overflow用户
提问于 2021-11-11 11:50:15
回答 1查看 649关注 0票数 0

我正在学习一篇关于Solidity和Python的教程(参考https://www.youtube.com/watch?v=M576WGiDBdQ&t=5447s)。

我已经到了安装Python和Brownie并通过VSCode运行的阶段,但在询问Brownie的版本brownie --version INFO: Could not find files for the given pattern(s). Brownie v1.17.1 - Python development framework for Ethereum时,我收到了以下通知

当我尝试对一个名为deploy.py (def main(): print ("hello!") )的文件运行一个非常基本的脚本时,结果如下:

代码语言:javascript
复制
PS C:\Users\chret\Documents\demo\brownie_simple_storage> brownie run scripts/deploy.py
INFO: Could not find files for the given pattern(s).
Brownie v1.17.1 - Python development framework for Ethereum

BrownieSimpleStorageProject is the active project.

Launching 'ganache-cli.cmd --port 8545 --gasLimit 12000000 --accounts 10 --hardfork istanbul --mnemonic brownie'...
File "C:\Users\chret\AppData\Roaming\Python\Python39\site-packages\brownie\_cli\__main__.py", line 64, in main
  importlib.import_module(f"brownie._cli.{cmd}").main()
File "C:\Users\chret\AppData\Roaming\Python\Python39\site-packages\brownie\_cli\run.py", line 44, in main
  network.connect(CONFIG.argv["network"])
File "C:\Users\chret\AppData\Roaming\Python\Python39\site-packages\brownie\network\main.py", line 50, in connect
  rpc.launch(active["cmd"], **active["cmd_settings"])
File "C:\Users\chret\AppData\Roaming\Python\Python39\site-packages\brownie\network\rpc\__init__.py", line 75, in launch
  self.process = self.backend.launch(cmd, **kwargs)
File "C:\Users\chret\AppData\Roaming\Python\Python39\site-packages\brownie\network\rpc\ganache.py", line 73, in launch
  return psutil.Popen(cmd_list, stdin=DEVNULL, stdout=out, stderr=out)
File "C:\Users\chret\AppData\Roaming\Python\Python39\site-packages\psutil\__init__.py", line 1312, in __init__
  self.__subproc = subprocess.Popen(*args, **kwargs)
File "C:\Program, line line, in in
  self._execute_child(args, executable, preexec_fn, close_fds,
File "C:\Program, line line, in in
  hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified

我试着从Python卸载并重新安装到Brownie,更改Brownie的文件存放位置,但由于我的知识非常有限(完全初学者),我现在被卡住了。

更新我再次重新安装了Python、pipx和brownie,现在消息略有不同,但仍然不能运行deploy.py的脚本。脚本是:

代码语言:javascript
复制
def main():
    print("Hello!")

当前的错误消息是:

代码语言:javascript
复制
PS C:\Users\chret\Documents\demo\brownie_simple_storage> brownie run scripts.deploy.py

INFO: Could not find files for the given pattern(s).
Brownie v1.17.1 - Python development framework for Ethereum

BrownieSimpleStorageProject is the active project.

Launching 'ganache-cli.cmd --port 8545 --gasLimit 12000000 --accounts 10 --hardfork istanbul --mnemonic brownie'...
  File "C:\Users\chret\AppData\Local\Programs\Python\Python39\lib\site-packages\brownie\_cli\__main__.py", line 64, in main
    importlib.import_module(f"brownie._cli.{cmd}").main()
  File "C:\Users\chret\AppData\Local\Programs\Python\Python39\lib\site-packages\brownie\_cli\run.py", line 44, in main
    network.connect(CONFIG.argv["network"])
  File "C:\Users\chret\AppData\Local\Programs\Python\Python39\lib\site-packages\brownie\network\main.py", line 50, in connect
    rpc.launch(active["cmd"], **active["cmd_settings"])
  File "C:\Users\chret\AppData\Local\Programs\Python\Python39\lib\site-packages\brownie\network\rpc\__init__.py", line 75, in launch
    self.process = self.backend.launch(cmd, **kwargs)
  File "C:\Users\chret\AppData\Local\Programs\Python\Python39\lib\site-packages\brownie\network\rpc\ganache.py", line 73, in launch
    return psutil.Popen(cmd_list, stdin=DEVNULL, stdout=out, stderr=out)
  File "C:\Users\chret\AppData\Local\Programs\Python\Python39\lib\site-packages\psutil\__init__.py", line 1312, in __init__
    self.__subproc = subprocess.Popen(*args, **kwargs)
  File "C:\Users\chret\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 951, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Users\chret\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 1420, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified
PS C:\Users\chret\Documents\demo\brownie_simple_storage>

该目录的图像:

任何帮助都将不胜感激:)

EN

回答 1

Stack Overflow用户

发布于 2021-11-15 13:30:20

您的deploy脚本位于contracts文件夹/目录中。

它需要位于项目的脚本目录中,即brownie_simple_storage/scripts文件夹中。

尝试将其移动到那里,并在该文件夹中运行您的脚本。

编辑:

您可能需要安装nodejsganache-cli

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/69927808

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档