[英]How to install openpyxl package in python using VS code on Mac
I have installed Python extention on VS code.我已经在 VS 代码上安装了 Python 扩展。 The version that I use on VS code is 3.9.
我在 VS 代码上使用的版本是 3.9。 when I try to install openpyxl package on VS code console using code
pip install openpyxl
I get an error:当我尝试使用代码
pip install openpyxl
openpyxl 在 VS 代码控制台上安装 openpyxl package 时,出现错误:
bash: /Library/Frameworks/Python.framework/Versions/3.9/bin/pip: No such file or directory
. bash: /Library/Frameworks/Python.framework/Versions/3.9/bin/pip: No such file or directory
。
I have a pip.py file in the corresponding directory.我在相应的目录中有一个 pip.py 文件。 What I am doing wrong?
我做错了什么?
Here is contents of my settings.json:这是我的设置内容。json:
{
"python.linting.pylintEnabled": true,
"python.linting.enabled": true,
"security.workspace.trust.untrustedFiles": "open",
"python.defaultInterpreterPath": "/Library/Frameworks/Python.framework/Versions/3.9/bin/python3.9"
} }
Try running this each time you open a terminal window:每次打开终端 window 时尝试运行:
alias python=/usr/local/bin/python3
alias pip=/usr/local/bin/pip3
I opened the.zprofile file on my mac and added the line export PYTHONPATH="/Users/username/Library/Python/3.9/bin"我在我的 Mac 上打开了 .zprofile 文件并添加了行 export PYTHONPATH="/Users/username/Library/Python/3.9/bin"
Save the file.保存文件。
Close Terminal.app;关闭终端.app;
Start Terminal.app again, to read in the new settings, and type this:再次启动 Terminal.app,读取新设置,然后输入:
echo $PYTHONPATH回声 $PYTHONPATH
It should show something like /Users/username/Library/Python/3.9/bin它应该显示类似 /Users/username/Library/Python/3.9/bin
https://bic-berkeley.github.io/psych-214-fall-2016/using_pythonpath.html ~ https://bic-berkeley.github.io/psych-214-fall-2016/using_pythonpath.html ~
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.