"Failed to import the site module" when running pip --version - python

I am using mac OS X, but am running into some trouble when I try to download pip to my terminal. If I type: python --version, I get the message that I have python 3.7 downloaded. So I would assume that I also have pip. But when I type pip --version, this message comes up on my terminal:
Fatal Python error: initsite: Failed to import the site module
ModuleNotFoundError: No module named 'site'
I attempted to download pip because I thought this might be occurring because I did not have it downloaded in the first place, but the same error message occurred during the download.

Related

ModuleNotFoundError: No module named 'pycoin'

Code:
from pycoin.ecdsa.secp256k1 import secp256k1_generator
When I run this, I get the error:
ModuleNotFoundError: No module named 'pycoin'
I've tried doing:
pip3 install pycoin
aswell as
pip install pycoin
Both of which have lead to the same error.
I've ran the code on python and python3 which also leads to the same error.
Any solutions?
Go to terminal or cmd on windows and type python3 (python2, python for older versions)
Then try to import the module there.
If the module in imported successfully then reopen your IDE. and then try.

no module named configobj ImportError

when I try to run my python programme in Kali Linux I get this error:
python myprogramme.py
ImportError: no module named configobj
so I installed this using these methods
sudo apt install python3-configobj
pip install configobj
both installed successfully however I'm still getting this same error and I wondered if there were any other factors that might be causing the error
thank you

I am still getting the error ImportError: No module named requests after installing requests using pip3

I am using Python 3.6.5 in Visual Studio Code on a Mac.
I installed pip3 and it is up to date, when I put in the command :
$ pip --version
I get this result :
pip 10.0.1 from /usr/local/lib/python3.6/site-packages/pip (python 3.6)
I imported the module requests.
And when I put in this command :
pip freeze | grep requests
I get this result :
requests==2.19.1
So I thought this meant the requests module was installed, but I still get the error ImportError: No module named requests when I put in : import requests in my file and try to run it.
Can somebody explain what is happening? Thank you :)
I found the answer, turns out I was using an extension called Code Runner and I thought it used the integrated terminal, where I had configured Python3. But turns out it uses its own interpreter. I added the following to my user settings:
"code-runner.executorMap": {
"python": "python3",
}
and now it works! :)

gcc error when installing python-axolotl module

I am trying to install yowsup2. Some dependency modules install okay but getting trouble when trying to install python-axolotl module. It keeps bringing error: command 'c:\mingw\bin\gcc.exe' failed with exit status 1 error. I downloaded the source module files for python-axolotl and tried manual installation but still getting the same error. There was also a 'undefined reference to '_head_C_build27_cpython_PCBuild_libpython27_a' error

Error message in Command Prompt when installing module

This is my first attempt at installing an add in for Python. I have extracted the twitter module to a folder within my Python33 directory that I have called 'Plug ins'. I have then navigated to this in Command Prompt and entered the following code that I have found on the Python website:
python setup.py install
That produced an error that 'python' was not a recognised command. When i removed 'python'a nd just ran:
setup.py install
I got the error message:
Import error: No module named 'setuptools'
What am I doing wrong?
Thanks
You need to install setuptools:
https://pypi.python.org/pypi/setuptools#installing-and-using-setuptools
Basically,
for Linux:
wget https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py -O - | python
for Windows 7:
download and execute this file.
for Windows 8, execute in PowerShell (as Admin):
(Invoke-WebRequest https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py).Content | python -

Categories

Resources