Python ImportError No module named sqlalchemy - python

I have sqlalchemy installed but when I try and import sqlachemy it comes up with an error
(base) Benjamats-Air:sqlalchemy_test benjamattesjaroen$ pip install sqlalchemy
Requirement already satisfied: sqlalchemy in /Users/benjamattesjaroen/anaconda3/lib/python3.7/site-packages (1.3.5)
(base) Benjamats-Air:sqlalchemy_test benjamattesjaroen$ python
Python 2.7.10 (default, Feb 7 2017, 00:08:15)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.34)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sqlalchemy
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named sqlalchemy
>>>

Related

Twilio only runs from my Python 3.7 directory on OS X

I installed Twilio:
pip3 install twilio
But it will run only from the Python 3 Applications folder.
// ♥ python3
Python 3.7.1 (v3.7.1:260ec2c36a, Oct 20 2018, 03:13:28)
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more
information.
>>> import twilio
>>> print(twilio.__version__)
6.21.0
Here is what I get from any other folder:
Python 3.7.1 (v3.7.1:260ec2c36a, Oct 20 2018, 03:13:28)
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import twilio
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/davidtannenbaum/Dropbox (Personal)/pythonpractice/twilio.py", line 2, in <module>
print(twilio.__version__)
AttributeError: module 'twilio' has no attribute '__version__'
Anyone know why it works in the Python 3.7 directory and gives an error anywhere else? How do I fix this?

Concurrent Futures import failed after installing it via PIP on virtual environment

Having installed with success futures on python 2.7.13, anyone wonder why it's not possible to import it ?
[user#server development]$ source app/bin/activate
(app) [user#server development]$ pip install futures
Requirement already satisfied: futures in ./app/lib/python2.7/site-packages
(app) [user#server development]$ python
Python 2.7.13 (default, Jan 18 2017, 18:22:53)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-55)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import futures
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named futures
thanks in advance.

mac mysqldb "import MySQLdb",but show "ImportError"

mac 10.11osx,and mysql5.5 python 2.7(system) mysqldb1.2.5,but when i do "import MySQLdb",it wrong----------
Python 2.7.10 (default, Oct 23 2015, 19:19:21)
[GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.0.59.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import MySQLdb
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Python/2.7/site-packages/MySQL_python-1.2.4-py2.7-macosx-10.11-intel.egg/MySQLdb/__init__.py", line 19, in <module>
import _mysql
ImportError: dlopen(/Library/Python/2.7/site-packages/MySQL_python-1.2.4-py2.7-macosx-10.11-intel.egg/_mysql.so, 2): no suitable image found. Did find:
/Library/Python/2.7/site-packages/MySQL_python-1.2.4-py2.7-macosx-10.11-intel.egg/_mysql.so: mach-o, but wrong architecture
could someone tell me why?

Utils module not imported

I have downloaded this package of Python Utils , and tried to install it, by entering the folder and typing:
python setup.py install
The output seems fine: the package installed and all dependencies processed.
However, when I try to import:
$ python
Python 2.7.2 (default, Dec 12 2011, 16:10:05)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-51)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import utils
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named utils
What am I getting wrong?
The package is called python_utils, not utils. import python_utils should work.

python rumps not working on OS X 10.10 - AttributeError: 'module' object has no attribute 'App'

I am trying to run some demo from http://rumps.readthedocs.org/en/latest/examples.html
using Ridiculously Uncomplicated Mac os x Python Statusbar apps and while importing rumps i get: AttributeError: 'module' object has no attribute 'App'
Mac-28cfe915100b-2:Desktop andi$ pip install rumps
Requirement already satisfied (use --upgrade to upgrade): rumps in /Library/Python/2.7/site-packages
Requirement already satisfied (use --upgrade to upgrade): pyobjc-core in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC (from rumps)
Cleaning up...
Mac-28cfe915100b-2:Desktop andi$ python
Python 2.7.6 (default, Sep 9 2014, 15:04:36)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import rumps
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "rumps.py", line 4, in <module>
class AwesomeStatusBarApp(rumps.App):
AttributeError: 'module' object has no attribute 'App'
Nothing to do with rumps but rather that you copied the demo into a a file named "rumps.py". The same error will happen in any other module you are trying to import from a file named the same thing.
$ echo "import math; math.sqrt(42)" > math.py
$ python
Python 2.7.5 (default, Mar 9 2014, 22:15:05)
[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import math
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "math.py", line 1, in <module>
import math; math.sqrt(42)
AttributeError: 'module' object has no attribute 'sqrt'

Categories