solcx为什么无法找到或使用已安装的编译器?

huangapple go评论55阅读模式
英文:

Why can't solcx find or use the compiler already installed?

问题

I have installed solcx and installed the solidity compiler via the respective methods

pip install py-solc-x

sudo add-apt-repository ppa:ethereum/ethereum
sudo apt-get update
sudo apt-get install solc

However visual studio can not find my solidity compiler

When I run solc --version within my normal terminal I get
solc, the solidity compiler commandline interface Version: 0.8.18+commit.87f61d96.Linux.g++

However when I run
compiled_contract = compile_files([{"path": filename, "content": contract_source_code}])
The error message I get is

which: no solc in (/home/{USER}/Desktop/Ethernaut/venv/bin:/home/{USER}/.nvm/versions/node/v19.3.0/bin:/app/bin:/app/bin:/app/bin:/usr/bin:/home/{USER}/.var/app/com.visualstudio.code/data/node_modules/bin:/home/{USER}/.foundry/bin)

Even though when I run which solc it outputs the following (normal desktop terminal):
/usr/bin/solc

When I run solc within the Visual Studio terminal, it says the following:
bash: solc: command not found

I thought it was a permission issue and I changed the owner of the solc binary within usr/bin, however that still did not resolve the issue.

英文:

I have installed solcx and installed the solidity compiler via the respective methods

pip install py-solc-x

sudo add-apt-repository ppa:ethereum/ethereum
sudo apt-get update
sudo apt-get install solc

However visual studio can not find my solidity compiler

When I run solc --version within my normal terminal I get
solc, the solidity compiler commandline interface
Version: 0.8.18+commit.87f61d96.Linux.g++

However when i run
compiled_contract = compile_files([{"path": filename, "content": contract_source_code}])
The error message i get is

which: no solc in (/home/{USER}/Desktop/Ethernaut/venv/bin:/home/{USER}/.nvm/versions/node/v19.3.0/bin:/app/bin:/app/bin:/app/bin:/usr/bin:/home/{USER}/.var/app/com.visualstudio.code/data/node_modules/bin:/home/{USER}/.foundry/bin)

Even though when I run which solc it outputs the following (normal desktop terminal):
/usr/bin/solc

When I run solc within visual studio terminal it says the following:
bash: solc: command not found

I thought it was a permission issue and I changed the owner of the solc binary within usr/bin however that still not resolved the issue

答案1

得分: 0

似乎存在关于使用Flatpak安装VS Code的问题。已使用不同的软件包管理器重新安装。

英文:

Seems to be an issue regarding flatpak install of vs code. Reinstalled using a different packet manager.

huangapple
  • 本文由 发表于 2023年2月6日 04:17:39
  • 转载请务必保留本文链接:https://go.coder-hub.com/75355243.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定