Please, observe:
PS Z:\dev\poc\SDR> jython.bat
Jython 2.5.3b1 (2.5:5fa0a5810b25, Feb 22 2012, 12:39:02)
[Java HotSpot(TM) 64-Bit Server VM (Sun Microsystems Inc.)] on java1.6.0_27
Type "help", "copyright", "credits" or "license" for more information.
>>> from zipfile import ZipFile
>>> z=ZipFile('d:/ookla/us_aaa.zip')
>>> z.open
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: ZipFile instance has no attribute 'open'
>>> ZipFile.open
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: class ZipFile has no attribute 'open'
>>>
So, where is the open method?
Thanks.
It's not available. ZipFile.open was added in Python 2.6, but Jython is still at version 2.5.
The method has been added in the Jython development repository.
See also How to simulate ZipFile.open in Python 2.5?.
Related
System information
Linux Ubuntu 16.04
TensorFlow version: tensorflow-gpu 1.5
Python version: 2.7
Installed using virtualenv: pip
CUDA/cuDNN version: CUDA9.0 & CUDNN7.0
Enviroment
Using anaconda to create a virtual environment named tf.
Error Msg
(tf) ➜ ~ python
Python 2.7.18 |Anaconda, Inc.| (default, Jun 4 2021, 14:47:46)
[GCC 7.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/xander/anaconda3/envs/tf/lib/python2.7/site-packages/tensorflow/__init__.py", line 24, in <module>
from tensorflow.python import *
File "/home/xander/anaconda3/envs/tf/lib/python2.7/site-packages/tensorflow/python/__init__.py", line 52, in <module>
from tensorflow.core.framework.graph_pb2 import *
File "/home/xander/anaconda3/envs/tf/lib/python2.7/site-packages/tensorflow/core/framework/graph_pb2.py", line 6, in <module>
from google.protobuf import descriptor as _descriptor
File "/home/xander/anaconda3/envs/tf/lib/python2.7/site-packages/google/protobuf/descriptor.py", line 113
class DescriptorBase(metaclass=DescriptorMetaclass):
^
SyntaxError: invalid syntax
>>> import tensorflow as tf
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/xander/anaconda3/envs/tf/lib/python2.7/site-packages/tensorflow/__init__.py", line 24, in <module>
from tensorflow.python import *
File "/home/xander/anaconda3/envs/tf/lib/python2.7/site-packages/tensorflow/python/__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
ImportError: cannot import name pywrap_tensorflow
As mentioned in this link, You're running the script in the same directory as TensorFlow. Try to move it out and you should be fine.
For example, Open the Linux command line and execute the script that you've just copied to desktop
Restarting the conda (using miniconda + conda-forge channel) works for me. But I don't know why, though...
C:\WINDOWS\system32>python
Python 3.7.9 (tags/v3.7.9:13c94747c7, Aug 17 2020, 18:58:18) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
import tensorflow
Traceback (most recent call last):
File "C:\Users\vbhav\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 64, in
from tensorflow.python._pywrap_tensorflow_internal import *
ImportError: DLL load failed: The specified module could not be found.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "", line 1, in
File "C:\Users\vbhav\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow_init_.py", line 41, in
from tensorflow.python.tools import module_util as module_util
File "C:\Users\vbhav\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python_init.py", line 39, in
from tensorflow.python import pywrap_tensorflow as _pywrap_tensorflow
File "C:\Users\vbhav\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 83, in
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "C:\Users\vbhav\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 64, in
from tensorflow.python._pywrap_tensorflow_internal import *
ImportError: DLL load failed: The specified module could not be found.
Failed to load the native TensorFlow runtime.
I installed Microsoft C++ redistributable application. And this error was fixed.
https://aka.ms/vs/16/release/vc_redist.x64.exe
when I try to import numpy, it gives me oserror. I have 64 bit processor.error as follow
Python 3.8.3 (default, Jul 2 2020, 17:30:36) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\admin\AppData\Roaming\Python\Python38\site-packages\numpy\__init__.py", line 138, in <module>
from . import _distributor_init
File "C:\Users\admin\AppData\Roaming\Python\Python38\site-packages\numpy\_distributor_init.py", line 26, in <module>
WinDLL(os.path.abspath(filename))
File "C:\Users\admin\anaconda31\lib\ctypes\__init__.py", line 373, in __init__
self._handle = _dlopen(self._name, mode)
OSError: [WinError 193] %1 is not a valid Win32 application
You'll need python.exe to be visible on the search path, or you could pass the full path to the executable file that is running the calling script
--also make sure the softwares you're running is for 64-bit processor
I recieved an error after the installation of pythonxy, as far as I know pythonxy including numpy and scipy, however I can't import these features on the command prompt.
How can I deal this problem ?
Here is my error message, thank you stackoverflow community.
C:\WINDOWS\system32>python
Python 3.4.3 (v3.4.3:9b73f1c3e601, Feb 24 2015, 22:43:06) [MSC v.1600 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named 'numpy'
>>> import scipy
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named 'scipy'
Python(x,y) installs Python 2.7. It seems that you have started Python 3. The discussion in How to run different python versions in cmd might help.
New to Jython.
I am this following How can I install various Python libraries in Jython? to use $ jython ez_setup.py, but ends with this error
Traceback (innermost last):
File "ez_setup.py", line 278, in ?
File "ez_setup.py", line 210, in main
File "ez_setup.py", line 139, in download_setuptools
ImportError: no module named distutils
I download ez_setup.py from here http://peak.telecommunity.com/dist/ez_setup.py. I have installed jython correct under the guidance from here http://www.jython.org/archive/22/installation.html
Thank you guys in advance.
It appears that distutils is not available in your version of Jython. From the link you provided, it looks like you are using Jython2.2, and when I start Jython2.2.1 and try to import distutils, I also get an ImportError:
Jython 2.2.1 on java1.7.0_79
Type "copyright", "credits" or "license" for more information.
>>> import distutils
Traceback (innermost last):
File "<console>", line 1, in ?
ImportError: no module named distutils
>>>
On a more recent version of Jython, the distutils module imports successfully:
Jython 2.7b2 (default:a5bc0032cf79+, Apr 22 2014, 21:20:17)
[Java HotSpot(TM) 64-Bit Server VM (Oracle Corporation)] on java1.8.0_60
Type "help", "copyright", "credits" or "license" for more information.
>>> import distutils
>>>
Is there a reason you must such an old version of Jython?