简体   繁体   中英

Visual studio Code, error terminal pipenv

This is my first question. I have a problem, I've installed pipenv with:

pip3 install pipenv

When I do this in a terminal in Ubuntu, I have not problem. But if I try use it in Visual Studio I get the error:

not found...you can install, sudo apt install pipenv

How do I fix this error?

It would be better to give clearer and more complete explanations so that your problem can be solved faster and more accurately. But for now I suggest the following solution.(i think your problem is in setting-up pipenv in VS Code). if the pipenv doesn't known in VSCode, take this action:

go to the terminal tab in VS-Code and simply ran:

1- pipenv --python 3.x (that x is your python version)
2- pipenv install

What I wrtoe above, VS Code not picking up the virtualenv by default. you can fix that. (solution below).

add these 3 lines to your local settings.json file that will be fix everything:

1-   {
2-       "python.venvPath": "/Users/me/.local/share/virtualenvs/",
3-       "python.pythonPath": "/Users/me/.local/share/virtualenvs/ENV-NAME/bin/python",
4-        "python.jediEnabled": true,
5-    }

After adding these and restart VS Code, probably you able to navigate around the project.


Pro tip: An easy way to figure out your python Path is to type the following command in the terminal where there's an active pipenv virtual env:

pipenv --py

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