invalid syntax when trying to install pip [duplicate] - python

This question already has answers here:
Why does "pip install" inside Python raise a SyntaxError?
(7 answers)
Closed 4 years ago.
i'm trying to install this package called 'exceptions' in command prompt for Python, yet all i get is "invalid syntax". what seems to be the issue? i tried things like
pip18 install exceptions (i'm using version 18 of pip)
pip -m install exceptions
enter image description here
enter image description here

The pip command isn't a python statement, it's a command like python and so it should be entered at the c:\Users\L31308> prompt.
pip install exceptions looks right, but unfortunately there doesn't appear to be an exceptions module to be installed. The packages are normally stored on the PyPI web site, sometimes referred to as "the cheese shop".
Perhaps if you could explain why you want to import this module and what it's supposed to do we might be able to find a fuller answer for you.

Related

Using Pip Install to Import a Python Library on Github [duplicate]

This question already has answers here:
Why does "pip install" inside Python raise a SyntaxError?
(7 answers)
Closed 1 year ago.
as shown in the picture, I'm trying to use Pip install to import a library on a github repository. However, when I do this, I receive an "SyntaxError: invalid syntax" error. What am I doing wrong? Note that this is on Google Colab.
[1]: https://i.stack.imgur.com/pPCv2.png
pip install is a console command, not a Python command. To issue commands to the console on Google Colab and other similar notebook environments, use an exclamation point at the beginning:
!pip install git+https://...

pip3 install not working invald syntax? (windows) [duplicate]

This question already has answers here:
Why does "pip install" inside Python raise a SyntaxError?
(7 answers)
Closed 1 year ago.
I've tried using the pip3 install function multiple times on Python 3.9 but it never worked. I first tried it with JupyterNotebook and ended up using Anaconda to install Jupyter. I am currently trying to install Twint and InstagramOSINT but every time I use pip3 install I get an error message saying SyntaxError: Invalid Syntax. I checked to see if I have pip3 installed on my PC and I do.
you need to run powershell as admin otherwise you will get this error.

How do I install modules such as (pandas/ openpyxl) [duplicate]

This question already has answers here:
How do I use installed packages in PyCharm?
(14 answers)
Closed 1 year ago.
Okay so I have just started to learn python. I use pycharm to currently write the code. I just dont understand how I install modules. For example I wish to load in excel files. I have seen that either pandas or openpyxl can be used, but I dont get how I get access to these modules. All videos I have seen online just type either install openpyxl or pip install pandas. 'install' does not come up as a valid function on my window. Other functions come up highlighted before I complete them and install seems to be like its not recognized and once executed I get a syntax error for install. Do I have to download these modules before installing?
pip install <package>
needs to be written in terminal, not in code window. In the bottom left corner you have "terminal" button, press it, and in new window type pip install whatever you want.

ModuleNotFoundError, but the package should be there [duplicate]

This question already has answers here:
ModuleNotFoundError: No module named 'requests' after pip install [duplicate]
(2 answers)
Closed 1 year ago.
Here is what I'm using:
Python 3.7.x on PyCharm 2018.2.4
Windows 10.
I'm following a tutorial about website parsing, but the struggle begins before I can even really start out.
I get the error message:
ModuleNotFoundError: No module named 'requests'
The package should be installed properly (pip3 install requests) and I run only that single version of python as far aI i know. I can find the package in the directory I'd expect it to be (C:\Users\Bob\AppData\Local\Programs\Python\Python37\Lib\site-packages).
I expect the same problem for the other package (beautifulsoup4), but the script doesn't even get that "far".
So, I'm aware that I must've done something incorrectly but I can't figure out what.
Any advice?
requests is a module which is needed for the script / the command you are trying to run but seems not to be part of the python installation or the python distribution you choose.
I can guess that you got the error while entering the following line:
>>> import requests
I would run the pip install request command from powershell and try to install the package:
python -m pip install requests
I do not know what you want to use python for but I usually advise to use a python distribution such as Anaconda which contains plenty of additional packages including requests.

Can't figure out how to download pip/ install libraries [duplicate]

This question already has answers here:
Why does "pip install" inside Python raise a SyntaxError?
(7 answers)
Closed 4 years ago.
I've been trying to install the plotly library for a while. Whenever I try to run the commands, it doesn't work. I have Python (3.7.1) downloaded, and I know that because I open it and I can type in it. I try to do $ pip install plotly, as found in Getting Started with Plotly for Python.
When I do that, it says invalid syntax. I don't really get how to download https://bootstrap.pypa.io/get-pip.py, which is the secure pip install file.
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
seems to work, but then when I try
python get-pip.py
It doesn't work again, because of an invalid syntax. I'm not sure what I'm doing wrong, so any help would be great.
It seems you might be running the code with Python 2 instead of Python 3. Check the Python version with the following command.
python --version
Perhaps try and execute the program again by calling Python 3 directly
python3 get-pip.py

Categories

Resources