pythonpyasn1

How to run pyasn1 installed with pip


Apparently I'm doing something wrong, and all instructions I have found literally everywhere say how to install (program name here) with PIP but not how to execute it.

I am trying to run pyasn1, using a python3 virtual environment.

I have also tried using my default python2.7 environment, but no love there, either.

python3 -m venv asn1_env
source asn1_env/bin/activate

Just to check that I'm in the new virtual environment.

which python
/Users/xxxx/asn1_env/bin/python

Now we install pyasn1 for the umpteenth time...

pip install pyasn1
Successfully installed pyasn1-0.4.5

This is where things go awry...

which pyasn1

(nothing, can't find it in the virtual path)

find . -name "pyasn1.*"

./asn1_env/lib/python3.7/site-packages/pyasn1

(only finds a directory, which contains a bunch of files, none of which are called pyasn1)

Obviously, this won't work, either...

python pyasn1.py
/usr/local/Cellar/python/3.7.2_2/Frameworks/Python.framework/Versions/3.7/Resources/Python.app/Contents/MacOS/Python: can't open file 'pyasn1.py': [Errno 2] No such file or directory

Solution

  • There is nothing to run in pyasn1 because it's a library, not a runnable program.

    The intended workflow is that you fist express your ASN.1 data structures in form of pyasn1 classes, then you could either decode serialized data (BER/DER/CER) into Python objects or vice-versa.