简体   繁体   中英

How to install openpyxl package in python using VS code on Mac

I have installed Python extention on VS code. The version that I use on VS code is 3.9. when I try to install openpyxl package on VS code console using code pip install openpyxl I get an error:

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. What I am doing wrong?

Here is contents of my settings.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:

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"

Save the file.

Close Terminal.app;

Start Terminal.app again, to read in the new settings, and type this:

echo $PYTHONPATH

It should show something like /Users/username/Library/Python/3.9/bin

https://bic-berkeley.github.io/psych-214-fall-2016/using_pythonpath.html ~

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM