I want to have Z3python on my Ubuntu 12.04 64-bit. I downloaded Z3 source, and compiled like below:
$autoconf
$./configure
$sudo make
$sudo make a
$sudo make o
Everything went well, but then I tried:
$ python
Python 2.7.3 (default, Sep 26 2012, 21:51:14)
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import z3
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named z3
It seems Z3python is not installed yet? I followed exactly the instructions in README, but it seems to miss something regarding Python binding?
please ignore, what i got is the old version of Z3.
a recommendation: please provide the source code of the latest Z3 in the homepage. i couldnt find it anywhere, then wrongly got the old version. finally, i had to download the latest version from the SourceControl, which was a bit tricky.
Related
I have a Python 2.7 question, if somebody can help.
When we install a Python module using pip, how do we make it available to all users? Please, see the example below (with module faker). The import works when I am root, but doesn’t work when I am ubuntu user.
I have already tried to install using option --system, and also changing umask, as recommended in some articles I have found. Didn’t work so far. Any ideas?
If we run "which python", both users point to the same one.
root#ip-172-30-244-157:/home/ubuntu#
root#ip-172-30-244-157:/home/ubuntu# python
Python 2.7.17 (default, Sep 30 2020, 13:38:04)
[GCC 7.5.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import faker
>>>
>>> exit()
root#ip-172-30-244-157:/home/ubuntu#
root#ip-172-30-244-157:/home/ubuntu#
root#ip-172-30-244-157:/home/ubuntu# exit
exit
ubuntu#ip-172-30-244-157:~$
ubuntu#ip-172-30-244-157:~$
ubuntu#ip-172-30-244-157:~$ python
Python 2.7.17 (default, Sep 30 2020, 13:38:04)
[GCC 7.5.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import faker
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named faker
>>>
Ok, I solved the issue.
In my case, the problematic module was "faker". But, when we install the faker, another additional module is installed as well (in this case - text-unidecode).
Then I uninstalled both modules, ran "umask 022" and re-installed the faker.
This solved the issue for all other users.
Thanks all for the help!
I use a Gentoo-based Docker image for CI with multiple versions of Python. Recently, I've started experiencing errors because one tool (coveralls) requires sqlite, which is missing. sqlite is part of the Python standard library.
This can be checked from the command line
>>> removing all .pyc files
>>> executing command
me#5b35f99c08af /source $ python
Python 3.6.9 (default, Dec 27 2019, 12:15:49)
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sqlite3
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'sqlite3'
I couldn't find any notes in the Gentoo packaging database about this, but I'm not really familiar with it as an OS. I assume there must have been a problem building some relevant library.
Python has been installed like this:
RUN emerge -q -u dev-lang/python:3.6
But the error occurs for all the versions I'm currently testing with: >= 3.5. Any ideas as to what I'm doing wrong?
I used mechanize in Python, but peppy said
$ pypy
Python 2.7.9 (9c4588d731b7fe0b08669bd732c2b676cb0a8233, Mar 31 2015, 07:55:22)
[PyPy 2.5.1 with GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>> import mechanize
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named mechanize
>>>> import sys
>>>> sys.path
['', '/usr/local/Cellar/pypy/2.5.1/libexec/site-packages/setuptools-14.3.1-py2.7.egg', '/usr/local/Cellar/pypy/2.5.1/libexec/site-packages/pip-6.0.8-py2.7.egg', '/usr/local/Cellar/pypy/2.5.1/libexec/lib_pypy/__extensions__', '/usr/local/Cellar/pypy/2.5.1/libexec/lib_pypy', '/usr/local/Cellar/pypy/2.5.1/libexec/lib-python/2.7', '/usr/local/Cellar/pypy/2.5.1/libexec/lib-python/2.7/lib-tk', '/usr/local/Cellar/pypy/2.5.1/libexec/lib-python/2.7/plat-darwin', '/usr/local/Cellar/pypy/2.5.1/libexec/lib-python/2.7/plat-mac', '/usr/local/Cellar/pypy/2.5.1/libexec/lib-python/2.7/plat-mac/lib-scriptpackages', '/usr/local/Cellar/pypy/2.5.1/libexec/site-packages']
Please tell me how to use mechanize in pypy.
I think I haven't create path but I don't know way.
PyPy does not automatically pick CPython paths. You either need to install mechanize separately (I suggest virtualenv) or you need to put path to it into sys.path or PYTHONPATH environment variable.
i'm tying to play with sqlite3 on my centos server but it reports always the same error (module installed)....
Python 2.7.3 (default, Jun 29 2012, 19:03:18)
[GCC 4.4.6 20110731 (Red Hat 4.4.6-3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sqlite3
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "sqlite3/__init__.py", line 24, in <module>
from dbapi2 import *
File "sqlite3/dbapi2.py", line 27, in <module>
from _sqlite3 import *
ImportError: No module named _sqlite3
on ubuntu and so on works fine.... any ideas of what i'm missing here?
i recompile the 2.7.3 again and it catch the sqlite3 libs well.
If you are under RHEL/centos 6, you can try this:
cp /usr/lib64/python2.6/lib-dynload/_sqlite3.so /usr/local/lib/python2.7/sqlite3/
This will work for CentOS:
ln -s /usr/lib64/python2.6/lib-dynload/_sqlite3.so /usr/local/lib/python2.7/lib-dynload/
/usr/local/lib/python2.7/ is already on python's path. No need to duplicate the file or add the python's path.
first find:
find / -name _sqlite3.so
/usr/usr/lib/python2.6/lib-dynload/_sqlite3.so
/usr/local/service/python2.7/lib/python2.7/lib-dynload/_sqlite3.so
/usr/lib64/python2.6/lib-dynload/_sqlite3.so
next
cp /usr/local/service/python2.7/lib/python2.7/lib-dynload/_sqlite3.so /usr/local/lib/python2.7/sqlite3/
this centso 6.5 python2.7.10
If you're using Python 2.7.3 on a Red Hat 5 or CentOS 5 machine, there was a bug that prevented the SQLite modules from compiling properly when building Python from source; you should see an error message when running make. It's since been fixed in 2.7.4 so your best option is to upgrade.
If that's not possible, then there's a patch available. Here's the bug page and the patch.
I'm trying to build python 2.5.2 on Solaris 8 using gcc 3.4.2. I can't see any immediate errors in the ./configure step but, once built and i enter the python shell doing an import time errors with :
Python 2.5.2 (r252:60911, Nov 21 2008, 18:45:42)
[GCC 3.4.2] on sunos5
Type "help", "copyright", "credits" or "license" for more information.
>>> import time
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named time
What am i doing wrong? From what i can see with a cursory google is that there might be an error with libstdc++.so, but i can't find any hard details.
Any suggestions would be most welcome.
Many thanks,
Al.
The time module is not built by default in Python, if you build from a source distribution you need to explicitly enable all the modules you want to compile.
Open up Modules/Setup.dist in the python source tree and comment out the line which says:
#time timemodule.c
To enable the build of time module. Also remember that you need to recompile Python for this to take an effect.