[Tutor] Using pip

James Reynolds eire1130 at gmail.com
Thu Jul 5 13:11:21 EDT 2018


On Thu, Jul 5, 2018 at 12:55 PM Hlavin, Matthew (GSFC-5460)[GSFC INTERNS] <
matthew.hlavin at nasa.gov> wrote:

> I just downloaded Python to work on a project at work. I'm writing a
> pretty simple program for data collection for an experiment. In order to
> get the data, though I need to install PyVISA. The website for PyVISA says
> I can install the library using the line:
> $ pip install -U pyvisa
> When I type this line, I get a syntax error for using the $, and when I
> remove the $, I get a syntax error for using the word install. I even tried
> just using the word pip and an error said 'pip' is not defined. I'm not
> sure if I'm not using some syntax wrong, or if its a completely different
> issue.
>
> Thanks for any help and insight
> Matt Hlavin
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor



What version of Python did you install and what operating system are you
using?

the $ is just a command prompt and it isn't used for the above command.

The important bit from your message is the "I even tried just using the
word pip and an error said 'pip' is not defined".

This means either A.) You have pip installed, but it's not on your path or
B.) You don't have pip installed.

If you installed latest python (which is 3.7), then you can can create a
virtual env directly and just use that, which contains pip as well.

(this all assumes that python is on your path already)

python -m venv env

this will create a virtual environment called "env".

After you create your virtual environment, you activate it ".
env/bin/activate". If you are windows it would be "env\Scripts\activate"

Once activated, you can install your package like: pip install pyvisa

you may also enjoy using ipython (pip install ipython) for this kind of use
case.

James


More information about the Tutor mailing list