Python: ImportError: No module named pkg_resources [duplicate] - python

This question already has answers here:
No module named pkg_resources
(38 answers)
Closed 8 years ago.
In order to run Pelican, I installed python2.7 and modified first line of file /usr/bin/pelican-quickstart
from:
#!/usr/bin/python
to
#!/usr/bin/env python
when I type pelican-quickstart an error occured:
Traceback (most recent call last):
File "/usr/bin/pelican-quickstart", line 5, in <module>
from pkg_resources import load_entry_point
ImportError: No module named pkg_resources
I found "pkg_resources" is in this directory:
/usr/lib/python2.6/site-package/
I'm wondering if I have to install some packages after python2.7 is installed?
or, how can I solve this problem.

The problem must be an issue with your setup tools, try the following:
pip install --upgrade setuptools
pip install --upgrade distribute
If this solution doesn't work, you can check the following answer

You said
/usr/lib/python2.6/site-package/
but should be
/usr/lib/python2.6/site-packages/

Related

Pygame not importing [duplicate]

This question already has answers here:
ImportError: No module named 'pygame'
(25 answers)
Closed 9 months ago.
I've downloaded pygame version 2.1.2 and I'm using it with python 3.10.4 but it is giving an error when I try to import it:
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import pygame
ModuleNotFoundError: No module named 'pygame'
I have tried it on vscode and it was working but it suddenly isn't working anymore. Any suggestions please?
Did you try install with pip like this: python -m pip install pygame?
Maybe you can find more answers on this page: ImportError: No module named 'pygame'

How can I run pip without sudo? [duplicate]

This question already has answers here:
Getting "Permission Denied" when running pip as root on my Mac
(6 answers)
Error after upgrading pip: cannot import name 'main'
(32 answers)
Closed 3 years ago.
Command pip doesn't work without sudo
I was happily using pip with sudo but I have read here that I shouldn't do that.
However, when I try to use pip without sudo I get this:
[souto#~]$ pip install <package-name>
Traceback (most recent call last):
File "/usr/bin/pip", line 9, in <module>
from pip import main
ImportError: cannot import name main
I have tried James Sullivan's tip so my .bash_history file has the content below but to no avail.
[souto#~]$ cat .bash_aliases
alias pip=/usr/bin/pip
I am working on WSL, in case this is relevant.

How to install a package to python which is not default [duplicate]

This question already has answers here:
no module named zlib
(9 answers)
Closed 6 years ago.
I am trying to add zlib package to my python. However, after I install it using "yum install zlib", only the default python (which is python 2.4.3) can import it. While the other python (3.4.4) still cannot use zlib.
When I try to import zlib in python 3.4.4 by
import zlib
It displays
Traceback (most recent call last):
File "< stdin >", line 1, in
ImportError: No module named 'zlib'
My question is, how can I install package to python which is not default?
PS. I installed both zlib and zlib-devel
Thanks
You might need to install the zlib-devel package as well: yum install zlib-devel.
Otherwise you need to post the full error message when you try to run import zlib.

Install python pymysql on win7 [duplicate]

This question already has answers here:
Python 3: ImportError "No Module named Setuptools"
(22 answers)
Closed 8 years ago.
So I am completely unfamiliar with python and wanted to install pymysql.
This is the actual command I typed in cmd and the response I got:
C:\>d:\python27\python d:\pymysql\setup.py install
Traceback (most recent call last):
File "d:\pymysql\setup.py", line 2, in <module>
from setuptools import setup, find_packages
ImportError: No module named setuptools
I have python 2.7.8 and MySQL 6.x
I followed the instructions from here.
I haven't tried to search for the error message but have not found anything. Maybe some of you guys can help?
Install setuptools from here first, and then try to install pymysql again.

ImportError: No module named bs4 [duplicate]

This question already has answers here:
ImportError: No Module Named bs4 (BeautifulSoup)
(26 answers)
Closed 8 years ago.
I installed BeautifulSoup4 using pip in OSX but I yet get this error:
dyn-72-33-214-45:craiglist mona$ python t1.py
Traceback (most recent call last):
File "t1.py", line 1, in <module>
from bs4 import BeautifulSoup
ImportError: No module named bs4
Any idea how to fix it?
dyn-72-33-214-45:craiglist mona$ pip install BeautifulSoup4
....
Successfully installed BeautifulSoup4
Cleaning up...
I installed it using easy_install and now it is working. However first you should use sudo su :
dyn-72-33-214-45:craiglist mona$ sudo su
sh-3.2# easy_install beautifulsoup4

Categories