我正在尝试从这个freeCodeCamp 视频中完成简单的收藏 NFT 教程。(我被困在从链接时间戳开始的确切位置开始的脚本上。)
对于那些无法打开视频的人,我正在尝试运行这个 brownie 命令:
brownie run scripts/deploy_and_create.py --network rinkeby
我收到以下错误:
dsine@DESKTOP-T74SG6U:/mnt/c/Users/dylan/projects/demos/nft-demo$ brownie run scripts/deploy_and_create.py --network rinkeby
Brownie v1.17.1 - Python development framework for Ethereum
NftDemoProject is the active project.
File "brownie/_cli/run.py", line 50, in main
return_value, frame = run(
File "brownie/project/scripts.py", line 53, in run
module = _import_from_path(script)
File "brownie/project/scripts.py", line 149, in _import_from_path
_import_cache[import_str] = importlib.import_module(import_str)
File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen, line line, in in
File "<frozen, line line, in in
File "<frozen, line line, in in
File "<frozen, line line, in in
File "<frozen, line line, in in
File "<frozen, line line, in in
File "<frozen, line line, in in
File "<frozen, line line, in in
File "<frozen, line line, in in
File "<frozen, line line, in in
File "<frozen, line line, in in
File "<frozen, line line, in in
File "<frozen, line line, in in
File "<frozen, line line, in in
File "<frozen, line line, in in
File "<frozen, line line, in in
File "<frozen, line line, in in
File "<frozen, line line, in in
File "<frozen, line line, in in
ModuleNotFoundError: No module named 'mnt.c.Users.dylan.projects'
我从 VSCode 中的 WSL Ubuntu 终端运行它。我也尝试在 powershell 中运行脚本。我确保我使用的是 Python 3 和 WSL 2。我不确定这里发生了什么。
这是我的 deploy_and_create.py 代码:
from scripts.helpful_scripts import get_account
from brownie import SimpleCollectible
sample_token_uri = "https://ipfs.io/ipfs/Qmd9MCGtdVz2miNumBHDbvj8bigSgTwnr4SbyH6DNnpWdt?filename=0-PUG.json"
OPENSEA_URL = "https://testnets.opensea.io/assets/{}/{}"
def main():
account = get_account()
simple_collectible = SimpleCollectible.deploy({"from":account})
tx = simple_collectible.createCollectible(sample_token_uri, {"from": account})
tx.wait(1)
print(f"Awesome, you can view your NFT at {OPENSEA_URL.format(simple_collectible.address, simple_collectible.tokenCounter() - 1)}")
print("Please wait up to 20 minutes and hit the refresh metadata button.")
和我的 brownie-config.yaml:
dependencies:
- OpenZeppelin/openzeppelin-contracts@3.4.0
compiler:
solc:
remappings:
- '@openzeppelin=OpenZeppelin/openzeppelin-contracts@3.4.0'
dotenv: .env
谁能帮我?谢谢!