ImportError: No module named site
hi: I'm Needing to get python 2.7.10 to cross compile correctly for an ARM embedded device. When I execute python using shell, it comes out this error:ImportError: No module named site.I have setted environment varible:PYTHONHOME and PYTHONPATH. Is there some good idea to sovle this issue? -- https://mail.python.org/mailman/listinfo/python-list
Fwd: ImportError: No module named site
hi: I'm Needing to get python 2.7.10 to cross compile correctly for an ARM embedded device. When I execute python using shell, it comes out this error:ImportError: No module named site.I have setted environment varible:PYTHONHOME and PYTHONPATH. Is there some good idea to sovle this issue? -- https://mail.python.org/mailman/listinfo/python-list
Re: Fwd: ImportError: No module named site
hi: Do you know, where can I download the python2.7.10-xcompile.patch file?thanks. On 07/24/2015 10:20 AM, Christopher Mullins wrote: What did you set those variables to? Also, output from python -v would be helpful. On Jul 23, 2015 10:15 PM, "Laura Creighton" <mailto:l...@openend.se>> wrote: In a message of Fri, 24 Jul 2015 09:37:35 +0800, "chenc...@inhand.com.cn <mailto:chenc...@inhand.com.cn>" write s: >hi: >I'm Needing to get python 2.7.10 to cross compile correctly for an ARM >embedded device. When I execute python using shell, it comes out this >error:ImportError: No module named site.I have setted environment >varible:PYTHONHOME and PYTHONPATH. Is there some good idea to sovle this >issue? You might want to try that question over here: https://mail.python.org/mailman/listinfo/mobile-sig I think you have an issue with dynamic library linking, but I don't know how to find out for sure. People there do. Laura -- https://mail.python.org/mailman/listinfo/python-list -- https://mail.python.org/mailman/listinfo/python-list
install pip
hi: I cross compiled python2.7.10 and install python on my embedded device. But now, I may install pip on my embedded device. So, how can i do that? -- https://mail.python.org/mailman/listinfo/python-list
pip
hi: Python 2.7.9 and later (on the python2 series), and Python 3.4 and later include pip by default.But i can not find it in python2.7.10 package. What's the matter? How can i install pip on my Embedded device? -- https://mail.python.org/mailman/listinfo/python-list
install pip
hi: I cross compiled python2.7.10 and install python on my embedded device. But now, I may install pip on my embedded device. So, I did it as follow: 1>I execute cmd:python -m ensurepip. It ocuurs errors as follow: Traceback (most recent call last): File "/usr/lib/python/lib/python27.zip/runpy.py", line 162, in _run_module_as_main File "/usr/lib/python/lib/python27.zip/runpy.py", line 72, in _run_code File "/var/app/python/libs/ensurepip.zip/ensurepip/__main__.py", line 4, in File "/var/app/python/libs/ensurepip.zip/ensurepip/__init__.py", line 226, in _main File "/var/app/python/libs/ensurepip.zip/ensurepip/__init__.py", line 123, in bootstrap File "/var/app/python/libs/ensurepip.zip/ensurepip/__init__.py", line 45, in _run_pip File "/tmp/tmprHZPx4/pip-6.1.1-py2.py3-none-any.whl/pip/__init__.py", line 15, in File "/tmp/tmprHZPx4/pip-6.1.1-py2.py3-none-any.whl/pip/vcs/subversion.py", line 9, in File "/tmp/tmprHZPx4/pip-6.1.1-py2.py3-none-any.whl/pip/index.py", line 30, in File "/tmp/tmprHZPx4/pip-6.1.1-py2.py3-none-any.whl/pip/_vendor/__init__.py", line 92, in load_module ImportError: No module named 'pip._vendor.html5lib' The message "/tmp/tmprHZPx4/pip-6.1.1-py2.py3-none-any.whl" point out the pip package in that dir, while it is not there. 2>As a result of the above error message, I download the pip-7.1.2 package and install it on my embedded device. It ocuurs errors as follow: # python setup.py install Traceback (most recent call last): File "setup.py", line 6, in from setuptools import setup, find_packages ImportError: No module named setuptools # 3> I I download the setuptools package and execute cmd: python setup.py install.It ocuurs errors as follow: # python setup.py install Traceback (most recent call last): File "setup.py", line 6, in from setuptools import setup, find_packages File "/var/app/python/libs/setuptools.zip/setuptools/__init__.py", line 12, in File "/var/app/python/libs/setuptools.zip/setuptools/extension.py", line 8, in File "/var/app/python/libs/setuptools.zip/setuptools/dist.py", line 19, in ImportError: No module named pkg_resources So, where can i download the pkg_resources package. Is there somebody installed pip on embedded device? can you tell me how to do that? -- https://mail.python.org/mailman/listinfo/python-list
python---configure file
hi: I download the python2.7.10 package and execute cmd: ./configure --help.It is messages as follow: Optional Packages: --with-PACKAGE[=ARG]use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-universal-archs=ARCH select architectures for universal build ("32-bit", "64-bit", "3-way", "intel" or "all") --with-framework-name=FRAMEWORK specify an alternate name of the framework built with --enable-framework .. .. --with(out)-ensurepip=[=OPTION] "install" or "upgrade" using bundled pip, default is "no" So, I do not know how to use package option: --with-PACKAGE[=ARG]. It(PACKAGE) means 3rd party packages which I download from website? which directory can i put it In python2.7.10 package? For example, I download pip7.1.2 from website and I put it in python2.7.10 package dir. Therefor, I add compile option --with-pip7.1.2=yes when i compile python2.7.10. Does it correct? --with(out)-ensurepip=[=OPTION], how can i use it? -- https://mail.python.org/mailman/listinfo/python-list
python---configure file
hi: I download the python2.7.10 package and execute cmd: ./configure --help.It is messages as follow: Optional Packages: --with-PACKAGE[=ARG]use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-universal-archs=ARCH select architectures for universal build ("32-bit", "64-bit", "3-way", "intel" or "all") --with-framework-name=FRAMEWORK specify an alternate name of the framework built with --enable-framework .. .. --with(out)-ensurepip=[=OPTION] "install" or "upgrade" using bundled pip, default is "no" So, I do not know how to use package option: --with-PACKAGE[=ARG]. It(PACKAGE) means 3rd party packages which I download from website? which directory can i put it In python2.7.10 package? For example, I download pip7.1.2 from website and I put it in python2.7.10 package dir. Therefor, I add compile option --with-pip7.1.2=yes when i compile python2.7.10. Does it correct? --with(out)-ensurepip=[=OPTION], how can i use it?Is there anybody know that? -- https://mail.python.org/mailman/listinfo/python-list
setenv
hi: This is not a question about python. It is a shell question. I'm sorry to bother you. But I really want to know it. As follow: I want to set a shell environment variable:PYTHONPATH. When i executeecho $PYTHONPATH, it is value:/usr/lib/python/Lib:/usr/lib/python/lib/python27.zip:/var/app/python/libs/pip-lib.zip. Now, I want to add value to it. The value is all files in a folder with the.zip end. For install, directory(/var/app/python/libs/) include gpio.zip, a.zip, b.zip and so on. So I want to add value:/var/app/python/libs/gpio.zip, /var/app/python/libs/a.zip, /var/app/python/libs/b.zip to environment variable:PYTHONPATH. I execute cmd: export PYTHONPATH='/var/app/python/libs/*zip':$PYTHONPATH, but its value is not correct. So, how can i do this? My program use setenv to set environment variable. -- https://mail.python.org/mailman/listinfo/python-list
numpy
hi: I have to use numpy package. My python runs on my embedded arm device. So, how do i cross compile numpy? -- https://mail.python.org/mailman/listinfo/python-list
Re: numpy
hi, Laura: My embedded arm device supports floating point operation. I have to use numpy and pandas packages. But now, I do not known how to cross compile numpy and pandas packages? On 09/11/2015 12:05 AM, Laura Creighton wrote: In a message of Thu, 10 Sep 2015 18:11:08 +0800, "chenc...@inhand.com.cn" write s: hi: I have to use numpy package. My python runs on my embedded arm device. So, how do i cross compile numpy? -- https://mail.python.org/mailman/listinfo/python-list Ask that one here: http://mail.scipy.org/mailman/listinfo/numpy-discussion Do you even have a floating point processor? I'm not an expert but I don't think that it makes sense to try to run numpy anywhere that doesn't have one. Laura -- https://mail.python.org/mailman/listinfo/python-list
python how to load multiple C libraries
hi: I encountered a problem. I use ctypes load multiple C libraries, but the libraries have dependence each other.So, how can i load these libraries. For example, I have two libraries:A、B, but A depends on B, B depends on A. So how do I load them? Is there anybody know how to do it? -- https://mail.python.org/mailman/listinfo/python-list
Re: python how to load multiple C libraries
hi: Most current compilers and linkers will search all object files, regard-less of order, but since not all compilers do this it is best to follow the convention of ordering object files from left to right . Python do that. So, is there anybody know how to solve the follow problem? On 09/16/2015 05:41 PM, Chris Angelico wrote: On Wed, Sep 16, 2015 at 7:35 PM, chenc...@inhand.com.cn wrote: I encountered a problem. I use ctypes load multiple C libraries, but the libraries have dependence each other.So, how can i load these libraries. For example, I have two libraries:A、B, but A depends on B, B depends on A. So how do I load them? Is there anybody know how to do it? How are the libraries built? A circular dependency is always a problem. How would a C program handle this? ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: python how to load multiple C libraries
hi: I use ctypes load multiple C libraries. Code like this: . history = CDLL("/usr/lib/libhistory.so", mode=RTLD_GLOBAL|RTLD_LAZY) ncurses = CDLL("/usr/lib/libncurses.so", mode=RTLD_GLOBAL|RTLD_LAZY) readline = CDLL("/usr/lib/libreadline.so", mode=RTLD_GLOBAL|RTLD_LAZY) ... When I execute my python scripts, it come out followed error: /var/app/python/scripts # python test.py Traceback (most recent call last): File "test.py", line 4, in history = CDLL("/usr/lib/libhistory.so", mode=RTLD_GLOBAL|RTLD_LAZY) NameError: name 'RTLD_LAZY' is not defined. So, I checked my ctypes source code, I found RTLD_LAZY defined in dlfcn.h header file like this: /* The MODE argument to `dlopen' contains one of the following: */ #define RTLD_LAZY 0x1 /* Lazy function call binding. */ #define RTLD_NOW 0x2 /* Immediate function call binding. */ #define RTLD_BINDING_MASK 0x3 /* Mask of binding time value. */ #define RTLD_NOLOAD 0x4 /* Do not load the object. */ #if 0 /* uClibc doesnt support these */ #define RTLD_DEEPBIND 0x8 /* Use deep binding. */ #endif /* If the following bit is set in the MODE argument to `dlopen', the symbols of the loaded object and its dependencies are made visible as if the object were linked directly into the program. */ #define RTLD_GLOBAL 0x00100 /* Unix98 demands the following flag which is the inverse to RTLD_GLOBAL. The implementation does this by default and so we can define the value to zero. */ #define RTLD_LOCAL 0 /* Do not delete object when closed. */ #define RTLD_NODELETE 0x01000 The first of all, I have added followed codes in function: PyMODINIT_FUNC init_ctypes(void) {...} in _ctypes.c file. /* add RTLD_LAZY and RTLD_NOW definitions*/ PyModule_AddObject(m, "RTLD_LAZY", PyInt_FromLong(RTLD_LAZY)); PyModule_AddObject(m, "RTLD_NOW", PyInt_FromLong(RTLD_NOW)); So, Is there anybody know how the CDLL can accept mode flag:RTLD_LAZY? On 09/16/2015 09:13 PM, Laura Creighton wrote: In a message of Wed, 16 Sep 2015 17:35:18 +0800, "chenc...@inhand.com.cn" write s: hi: I encountered a problem. I use ctypes load multiple C libraries, but the libraries have dependence each other.So, how can i load these libraries. For example, I have two libraries:A、B, but A depends on B, B depends on A. So how do I load them? Is there anybody know how to do it? I don't know how to do this with ctypes (which doesn't mean it cannot be done, just that I haven't ever wanted to do this). What happens if you make a small file that loads both separately and loads that one first? It may be that you can get what you want with by loading the first lib RTLD_LAZY instead of RTLD_NOW. see: http://stackoverflow.com/questions/22591472/dyanamic-library-linking-by-rtld-lazy see: this very old thread, maybe CTypes knows about it now. http://osdir.com/ml/python.ctypes/2006-10/msg00029.html But I have never tried. These days I used cffi instead of ctypes. If you use cffi https://pypi.python.org/pypi/cffi there should not be any problem if you use ffi.set_source(), only once, but mentioning both libs in the libraries=[...] argument. Laura -- https://mail.python.org/mailman/listinfo/python-list
libevent-python
hi: I use libevent-python package currently. I read the file eventmodule.c, but I can not understand the function: static EventObject *EventBase_CreateEvent(EventBaseObject *self, PyObject *args, PyObject *kwargs) { EventObject *newEvent = NULL; newEvent = (EventObject *)Event_New(&Event_Type,NULL,NULL); if (Event_Init(newEvent, args, kwargs) < 0){ return NULL; } if (PyObject_CallMethod((PyObject *)newEvent, "setEventBase", "O", self) == NULL){ return NULL; } return newEvent; } So, I can not know the param "EventBaseObject *self" is what? And I read the examples/echo_server.py file, I read the follow source: class BaseConnection(object): bufferSize = 2**16 def __init__(self, sock, addr, server): self.sock = sock self.addr = addr self.server = server self.sock.setblocking(False) self.buf = [] self.readEvent = libevent.createEvent( self.sock,libevent.EV_READ|libevent.EV_PERSIST, self._doRead) self.writeEvent = libevent.createEvent( self.sock,libevent.EV_WRITE, self._doWrite) self.startReading() So, I can not see pass the self parameter. Is anybody know this? -- https://mail.python.org/mailman/listinfo/python-list