Home > Mobile >  What is the difference between installing a package in my Windows CMD and in VS Code terminal?
What is the difference between installing a package in my Windows CMD and in VS Code terminal?

Time:04-07

I am doing this project where i need to install a package called Twint. I want to install this package and use it's commands in my VS Code.

What happends when i for example type this in my Windows CMD?

pip3 install --user --upgrade git https://github.com/twintproject/twint.git@origin/master#egg=twint

Because i can't type this in my VS code terminal, where i usually install packages with pip.

It will return an error that says ERROR: Cannot find command 'git' - do you have 'git' installed and in your PATH?''

Now if i run this in my Windows Command it seems that i can't directly import the package in VS code? Can anyone help me out with this confusion, where does the files get stored and how do i create good habbits around installing packages?

Hope someone understands what im struggeling with here. Best

CodePudding user response:

It is often the case that computers have more than one version of python installed and that editors like VS code use a different version than pip uses on the command line. pip installs packages where the version of python it is linked to expects them to be, but VScode doesn't know to look there.

It sounds like you have git installed where pip installs things, so you can upgrade from the command line without issue, but there's no installation of git where VScode is looking, so there's nothing to upgrade.

You either need to find where pip installs things and add it to the $PATH VScode uses, or try running a variation of python -m pip install --user git (specifying a specific url, or other things, as needed) from within VScode, which will ensure the package gets installed in a place that VScode looks for packages.

CodePudding user response:

Download and Install git in your windows from here:

https://git-scm.com/download/win

Then add its installation bin path to your windows's environment path. Then you will find the git command at the command prompt globally.

This may solve you problem.

  • Related