import error in python [duplicate] - python

This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
MySQL for Python in Windows
I can't import the MySQLdb package in Python. How to install the msqldb package and where to place it in Python? Then when I compile the code there is an error like no module named MySQLdb. Python version is 2.6.4 then MySQLdb version is 1.2.3c1. Pls clarify this.

On Windows you use binary version installer (contains already compiled MySQLdb):
http://www.lfd.uci.edu/~gohlke/pythonlibs/#mysql-python
http://www.codegood.com/archives/4

Related

Cannot run Python module [duplicate]

This question already has answers here:
How to use 3to2
(4 answers)
Closed 11 months ago.
I am trying to run the Python 3 module '3to2' on Windows 10. Here is part of my pip3 list:
Package Version
----------------------------- -----------
3to2 1.1.1
I am trying to execute it with py -3 -m 3to2, but am receiving this:
C:\Users\Ben Bistline\AppData\Local\Programs\Python\Python39\python.exe: No module named 3to2
I think it has something to do with my Python Path, but I am unsure.
Thanks!
There is no module called 3to2. Module names can't start with a digit. Instead, there should be a standalone file in your "...\Programs\Python\Python39\Scripts"
directory called 3to2.py. That's what you need to run.

How to install modules using IDLE [duplicate]

This question already has answers here:
Installing python module within code
(12 answers)
Closed 3 years ago.
I have some code that uses modules that are not installed by default (eg. Numpy), and I want to give the program to a friend of mine who does not have that module.
I do not want him to have to go through the tedious process of using cmd to install the module. Is there any way to install the module from within the code itself? Like:
import pip
pip.install('numpy')
(completely hypothetical)
BTW: I am using Windows 10
from subprocess import call
module=input('Name module: ')
try:
call(['pip', 'install', module])
except Exception:
print('Error')

How to import logistic_sgd [duplicate]

This question already has answers here:
logistic_sgd module, where to find it?
(4 answers)
Closed 5 years ago.
Now, I am using anaconda 2 and python 2.7 to try to complete an auto-encoder problem. The code on the internet requires "import logistic_sgd". However, when I wrote "pip install logistic_sgd" in my cmd, I get:
could not find a version that satisfies the requirement logistic_sgd
No matching distribution found for logistic_sgd
Can someone help me solve the problem?
logistic_sgd.py is a file you need to download: http://deeplearning.net/tutorial/code/logistic_sgd.py

How to download a module from Github [duplicate]

This question already has answers here:
PIP install a Python Package without a setup.py file?
(2 answers)
Closed 5 years ago.
I am new to python and I am having trouble downloading a module from GitHub: https://github.com/petercerno/good-morning
I have looked online for solutions, but each solution I try does not work. I have tried:
pip install https://github.com/petercerno/good-morning.git
I get an error that says, "Cannot unpack file" & "Cannot determine archive format." I have no idea why I am getting this error.
Just save good_download.py and good_morning.py to the same directory as your Python script, and then import them:
import good_morning
import good_download
# do stuff!

What all packages do I have? [duplicate]

This question already has answers here:
Python Interpreter Mode - What are some ways to explore Python's modules and its usage
(3 answers)
Closed 8 years ago.
OS Windows XP SP3
situation
I installed three python exes on my machine.
Python 2.6
Python 2.7
Python EPD ENABLED (for pylab)
problem
I installed wxPython and in the selection I decided to install it to Python in system registry
I don't know to which python this package was installed.
what I tried
I tried writing import wx on all the shells and found that it was installed to EPD python.
bigger issue
I don't want to keep doin this each time I install a package. So is there a command that can be used in the shell or any other way, so that I can know about all the packages installed?
please help me with this issue.
Type help() in the shell. And then in the help prompt type modules to see a complete list of all modules.
You can get a complete list with sys.builtin_module_names and pkgutil.walk_packages():
import pkgutil
import sys
print sys.builtin_module_names + [name for module_loader, name, ispkg in pkgutil.walk_packages()]
The modules subcommand of help() puts a friendlier interface on top of these results.

Categories

Resources