Skip to main content

Use pip instead of easy_install.

With pip, list all installed packages and their versions via:

pip freeze

On most Linux systems, you can pipe this to grep (or findstr on Windows) to find the row for the particular package you're interested in.


Linux:

pip freeze | grep lxml

lxml==2.3

Windows:

pip freeze | findstr lxml

lxml==2.3


For an individual module, you can try the __version__ attribute. However, there are modules without it:

python -c "import requests; print(requests.__version__)"
2.14.2

python -c "import lxml; print(lxml.__version__)"
python -c "import requests; print(requests.__version__)"
2.14.2

python -c "import lxml; print(lxml.__version__)"

Traceback (most recent call last):
File "<string>", line 1, in <module>
AttributeError: 'module' object has no attribute 'version''__version__'

Lastly, as the commands in your question are prefixed with sudo, it appears you're installing to the global python environment. I strongly advise to take look into Python virtual environment managers, for example virtualenvwrapper.

Use pip instead of easy_install.

With pip, list all installed packages and their versions via:

pip freeze

On most Linux systems, you can pipe this to grep (or findstr on Windows) to find the row for the particular package you're interested in.


Linux:

pip freeze | grep lxml

lxml==2.3

Windows:

pip freeze | findstr lxml

lxml==2.3


For an individual module, you can try the __version__ attribute. However, there are modules without it:

python -c "import requests; print(requests.__version__)"
2.14.2

python -c "import lxml; print(lxml.__version__)"

Traceback (most recent call last):
File "<string>", line 1, in <module>
AttributeError: 'module' object has no attribute 'version'

Lastly, as the commands in your question are prefixed with sudo, it appears you're installing to the global python environment. I strongly advise to take look into Python virtual environment managers, for example virtualenvwrapper.

Use pip instead of easy_install.

With pip, list all installed packages and their versions via:

pip freeze

On most Linux systems, you can pipe this to grep (or findstr on Windows) to find the row for the particular package you're interested in.


Linux:

pip freeze | grep lxml

lxml==2.3

Windows:

pip freeze | findstr lxml

lxml==2.3


For an individual module, you can try the __version__ attribute. However, there are modules without it:

python -c "import requests; print(requests.__version__)"
2.14.2

python -c "import lxml; print(lxml.__version__)"

Traceback (most recent call last):
File "<string>", line 1, in <module>
AttributeError: 'module' object has no attribute '__version__'

Lastly, as the commands in your question are prefixed with sudo, it appears you're installing to the global python environment. I strongly advise to take look into Python virtual environment managers, for example virtualenvwrapper.

Clarity.
Source Link
Mateen Ulhaq
  • 27.7k
  • 21
  • 121
  • 155

I suggest using pip in placeUse pip instead of easy_installeasy_install.. 

With pip, you can list all installed packages and their versions withvia:

pip freeze

InOn most Linux systems, you can pipe this to grep (or findstr on Windows) to find the row for the particular package you're interested in:.

 

Linux:

pip freeze | grep lxml

lxml==2.3

Windows:

pip freeze | findstr lxml

lxml==2.3

 

For an individual module, you can try the __version__ attribute. However, there are modules without it:

python -c "import requests; print(requests.__version__)"
2.14.2

python -c "import lxml; print(lxml.__version__)"

Traceback (most recent call last):
File "<string>", line 1, in <module>
AttributeError: 'module' object has no attribute 'version'

Lastly, as the commands in your question are prefixed with sudo, it appears you're installing to the global python environment. I strongly advise to take look into Python virtual environment managers, for example virtualenvwrapper.

I suggest using pip in place of easy_install. With pip, you can list all installed packages and their versions with

pip freeze

In most Linux systems, you can pipe this to grep (or findstr on Windows) to find the row for the particular package you're interested in:

Linux:

pip freeze | grep lxml

lxml==2.3

Windows:

pip freeze | findstr lxml

lxml==2.3

For an individual module, you can try the __version__ attribute. However, there are modules without it:

python -c "import requests; print(requests.__version__)"
2.14.2

python -c "import lxml; print(lxml.__version__)"

Traceback (most recent call last):
File "<string>", line 1, in <module>
AttributeError: 'module' object has no attribute 'version'

Lastly, as the commands in your question are prefixed with sudo, it appears you're installing to the global python environment. I strongly advise to take look into Python virtual environment managers, for example virtualenvwrapper.

Use pip instead of easy_install. 

With pip, list all installed packages and their versions via:

pip freeze

On most Linux systems, you can pipe this to grep (or findstr on Windows) to find the row for the particular package you're interested in.

 

Linux:

pip freeze | grep lxml

lxml==2.3

Windows:

pip freeze | findstr lxml

lxml==2.3

 

For an individual module, you can try the __version__ attribute. However, there are modules without it:

python -c "import requests; print(requests.__version__)"
2.14.2

python -c "import lxml; print(lxml.__version__)"

Traceback (most recent call last):
File "<string>", line 1, in <module>
AttributeError: 'module' object has no attribute 'version'

Lastly, as the commands in your question are prefixed with sudo, it appears you're installing to the global python environment. I strongly advise to take look into Python virtual environment managers, for example virtualenvwrapper.

Fixed the weird syntax highlighting (as a result, the diff looks more extensive than it really is - use view "Side-by-side Markdown" to compare), etc.
Source Link
Peter Mortensen
  • 31.4k
  • 22
  • 110
  • 134

I suggest using pip in place of easy_install. With pip, you can list all installed packages and their versions with

pip freeze
pip freeze

In most Linux systems, you can pipe this to grep (or findstr on Windows) to find the row for the particular package you're interested in:

Linux:

pip freeze | grep lxml

lxml==2.3
pip freeze | grep lxml

lxml==2.3

Windows:

pip freeze | findstr lxml

lxml==2.3
pip freeze | findstr lxml

lxml==2.3

For an individual module, you can try the __version__ attribute. However, there are modules without it:

python -c "import requests; print(requests.__version__)"
2.14.2

python -c "import lxml; print(lxml.__version__)"

Traceback (most recent call last):
  File "<string>", line 1, in <module>
AttributeError: 'module' object has no attribute '__version__'
python -c "import requests; print(requests.__version__)"
2.14.2

python -c "import lxml; print(lxml.__version__)"

Traceback (most recent call last):
File "<string>", line 1, in <module>
AttributeError: 'module' object has no attribute 'version'

Lastly, as the commands in your question are prefixed with sudo, it appears you're installing to the global python environment. I strongly advise to take look into Python virtual environment managers, for example virtualenvwrapper.

I suggest using pip in place of easy_install. With pip, you can list all installed packages and their versions with

pip freeze

In most Linux systems, you can pipe this to grep (or findstr on Windows) to find the row for the particular package you're interested in:

Linux:

pip freeze | grep lxml

lxml==2.3

Windows:

pip freeze | findstr lxml

lxml==2.3

For an individual module, you can try the __version__ attribute. However, there are modules without it:

python -c "import requests; print(requests.__version__)"
2.14.2

python -c "import lxml; print(lxml.__version__)"

Traceback (most recent call last):
  File "<string>", line 1, in <module>
AttributeError: 'module' object has no attribute '__version__'

Lastly, as the commands in your question are prefixed with sudo, it appears you're installing to the global python environment. I strongly advise to take look into Python virtual environment managers, for example virtualenvwrapper.

I suggest using pip in place of easy_install. With pip, you can list all installed packages and their versions with

pip freeze

In most Linux systems, you can pipe this to grep (or findstr on Windows) to find the row for the particular package you're interested in:

Linux:

pip freeze | grep lxml

lxml==2.3

Windows:

pip freeze | findstr lxml

lxml==2.3

For an individual module, you can try the __version__ attribute. However, there are modules without it:

python -c "import requests; print(requests.__version__)"
2.14.2

python -c "import lxml; print(lxml.__version__)"

Traceback (most recent call last):
File "<string>", line 1, in <module>
AttributeError: 'module' object has no attribute 'version'

Lastly, as the commands in your question are prefixed with sudo, it appears you're installing to the global python environment. I strongly advise to take look into Python virtual environment managers, for example virtualenvwrapper.

Active reading [<https://en.wikipedia.org/wiki/Linux> <https://en.wikipedia.org/wiki/Python_%28programming_language%29>]. Removed the shell prompts to avoid confusion.
Source Link
Peter Mortensen
  • 31.4k
  • 22
  • 110
  • 134
Loading
added 108 characters in body
Source Link
CDT
  • 10.8k
  • 21
  • 76
  • 99
Loading
grammar, clarity, python 3 compatibility (question specified python2, but might as well make the answer compatible)
Source Link
Loading
replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link
URL Rewriter Bot
URL Rewriter Bot
Loading
added 402 characters in body
Source Link
alko
  • 48.7k
  • 12
  • 99
  • 105
Loading
Source Link
alko
  • 48.7k
  • 12
  • 99
  • 105
Loading