glob2 install using IDLE on Mac - python

So, my exercise says to use glob2 but I tried like six ways and never could get the module installed. I am using IDLE for my terminal. When I open the folder that has all the modules in it, I see pip and glob.
I am using python 3.8, IDLE on a Mac using High Sierra
I tried:
import pip #got no error
pip install glob2
SyntaxError: invalid syntax
Also tried this:
pip.install('glob2')
Traceback (most recent call last):
File "", line 1, in
pip.install('glob2')
NameError: name 'pip' is not defined
I then looked up the path and tried using that:
import sys; sys.executable
'/Library/Frameworks/Python.framework/Versions/3.8/bin/python3.8'
/Library/Frameworks/Python.framework/Versions/3.8/bin/python3.8 -m pip install glob2
SyntaxError: invalid syntax
at this point I am at a loss. The last suggestion was posted here: https://www.honchosearch.com/blog/seo/install-python-modulespackage-using-idle-mac/

Related

ModuleNotFoundError: No module named 'cryptography'

these are the Error messages I am geeting on running any of my project modules.
Traceback (most recent call last):
File "C:\Users\hsnl\BlockchainCodesTutor\Wallet.py", line 3, in <module>
import Transactions
File "C:\Users\hsnl\BlockchainCodesTutor\Transactions.py", line 2, in <module>
import Signatures
File "C:\Users\hsnl\BlockchainCodesTutor\Signatures.py", line 2, in <module>
import cryptography
ModuleNotFoundError: No module named 'cryptography'
I have already installed the cryptography module and was working perfectly until today I start getting this message that " No module named 'cryptography'".
I have again installed the cryptography as well as pip package but still showing the same error.
There might be loose versions running on your system. Please try the following:
python -m pip uninstall cryptography
python -m pip install cryptography
You can also check out this with python -m to make sure you are not using a loose pip.
You might not have cryptogtaphy installed correctly. I see you are using windows. Open commandline as an administrator and run pip install cryptography again. Enshure that the installation finishes without any errors and consider to restart your python interpreter after installation.
For further help you should post more details like the output of pip and your code leading to the error, so a more detailed answer for your problem can be given.
Try download cryptography whl from here.
Then use pip install cryptography-XXX.whl
For example:
pip install cryptography-3.3.1-cp36-abi3-win_amd64.whl
And now just supports python2.7 and python3.6.

Error in installing Pdfminer package in Anaconda

I have installed Anaconda 2.5 and used spyder with Python2.7 for sometime. I used pdfminer those days. Then I wanted to use Python3.6. So I have uninstalled Anaconda and installed Anaconda3.5. And there is no problem in using Python3.5 and I used more packages too. But now am trying to install pdfminer. Am getting some errors.
Using cached https://files.pythonhosted.org/packages/57/4f/e1df0437858188d2d36466a7bb89aa024d252bd0b7e3ba90cbc567c6c0b8/pdfminer-20140328.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\PRIYA~1.MUT\AppData\Local\Temp\pip-install-fzctx8lo\pdfminer\setup.py",line 3, in <module>
from pdfminer import __version__
File "C:\Users\PRIYA~1.MUT\AppData\Local\Temp\pip-install-fzctx8lo\pdfminer\pdfminer\__init__.py", line 5
print __version__
^
`SyntaxError: Missing parentheses in call to 'print'. Did you mean print(__version__)?`
I knew there is some issues because print __version__ needs to be like print (__version__). but I don't know where I need to edit. And this path
"C:\Users\PRIYA~1.MUT\AppData\Local\Temp\pip-install-fzctx8lo\pdfminer\pdfminer__init__.py"
doesn't exist on my system.Kindly help me in solving this.
I manually downloaded pdfminer-20140328.tar.gz from the link https://pypi.org/project/pdfminer/ and tried to install it using the command pip install -e <path>. But I got the same error. Then I have opened the pdfminer__init__.py file and edited accordingly to Python3.6. I have no idea why pdfminer package doesn't support Python3.6 directly. Eventhough installed, there is some dependency error. So I can't use that in Python3.6.

Installing numpy, cython, cpython for Python 2.7.12

I have been trying to install numpy for Python 2.7.12 on a ubuntu 16.04 machine, but am not sure I am doing the right thing.
I issued the command
python setup.py install
and received the following error message:
ImportError: No module named Cython.Compiler.Main
So I have also been trying to install the cython package and received another error message:
/Cython-0.28.1/Cython/Plex/Scanners.c:19:20: fatal error: Python.h: No such file or directory
I thought this problem required me to install cpython. Trying to install this resulted in the following error message:
Traceback (most recent call last):
File "setup.py", line 4, in <module>
import sys, os, importlib.machinery, re, optparse
ImportError: No module named machinery
I am somewhat stumped about how to continue. Am I on the right path? Is there a different way I could try (the computer in question cannot connect to the internet)?
You can check if pip is install thanks to the command which pip,
in my case :
$ which pip
/home/usr1/anaconda3/bin/pip
If pip is not install install it : instruction here
then you should be able to use it such as :
pip install numpy
an alternative is to use : conda install
In the terminal use:
pip install numpy
If you get any error like 'permission denied', try:
sudo pip install numpy

SyntaxError when pip install install NLTK

I am coding on Python 2.7. I want a large list of words to have access to. Looking around, I have found that nltk has what I'm looking for. However, every time I try and install it I get a syntax error. I have tried doing the commands in the shell and in files. I have no true understanding of how pip, install, and download commands work. I am on a mac, which other threads have said could affect things. I have tried...
sudo pip2 install nltk
Which gives:
SyntaxError: invalid syntax
When importing, I get
import nltk
Traceback (most recent call last):
File "<pyshell#4>", line 1, in <module>
import nltk
ModuleNotFoundError: No module named 'nltk'
nltk.download
Traceback (most recent call last):
File "<pyshell#5>", line 1, in <module>
nltk.download
NameError: name 'nltk' is not defined
and a few other suggestions from other threads, but nothing works. Please help.
pip is your python package manager. It is a command line tool, and not a python function, object or method. This means you can't call pip from within python (at least not by just typing pip ... into a python interpreter). pip should come along with your installation of python 2.7, so you don't need to install it, as long as you have python installed.
You need to call pip from your command line (on a mac, this would most likely be from terminal). So you need to open your terminal, type pip install nltk, which should install your package.
Then, you can start python by using the command python in terminal. You can then import nltk using import nltk.
Only once you've followed those steps, and successfully installed and imported the nltk package, can you use nltk.download() to download nltk data. nltk.download() in itself has nothing to do with installing the package.
I would recommend following a python tutorial, such as the one linked, in order to gain an understanding of how to use the python interpreter. This should explain how to install packages, and use basic python functionality.
Most versions of Mac OS come with Python version 2.7, but not with pip.
First verify that you have pip installed from the command line:
pip -V
If pip is not installed, follow the instructions here:
How do I install pip on macOS or OS X?
Then, directly in the terminal type (not in the python interpreter)
pip install nltk
Then, open your python interpreter from the command line:
python
and in the python interpreter, try importing nltk
import nltk

Tensorflow in windows using python pip

Installed python 3.5.2 and also tensorflow using pip command but getting error while importing tensorflow package.
Used command as import tensorflow as tf to import tensorflow. But got error as;
Traceback (most recent call last):
File "", line 1, in
ImportError: No module named 'tensorflow'
How can I rectify this error?
Can I get answer for this as soon as possible..
Are you running on a IDE or ipython or Jupyter?
If yes, it's likely the IDE is using a different python such as virtualenv. It's possible there are multiple pythons installed in your system.
Open cmd and try the following
$ where python
$ python -c "import tensorflow"
Make sure the path you get is same as the installation path.
If there is still an error, compare with this path
$ where pip
It's possible your system is using a different python path if there are multiple python.

Categories