+ 2

Проверка модулей

Есть ли команда, которая проверяет установленные библиотеки? В частности, если говорить про SoloLearn, можно ли тут устанавливать модули?

20th Dec 2017, 9:52 AM
Aland
Aland - avatar
7 Respostas
+ 3
import pip installed_packages = pip.get_installed_distributions() installed_packages_list = sorted(["%s==%s" % (i.key, i.version) for i in installed_packages]) print(installed_packages_list) As a (too long) one liner: sorted(["%s==%s" % (i.key, i.version) for i in pip.get_installed_distributions()]) Giving: ['behave==1.2.4', 'enum34==1.0', 'flask==0.10.1', 'itsdangerous==0.24', 'jinja2==2.7.2', 'jsonschema==2.3.0', 'markupsafe==0.23', 'nose==1.3.3', 'parse-type==0.3.4', 'parse==1.6.4', 'prettytable==0.7.2', 'requests==2.3.0', 'six==1.6.1', 'vioozer-metadata==0.1', 'vioozer-users-server==0.1', 'werkzeug==0.9.4'] I added the result of this call to my flask server, so when I call it with http://example.com/exampleServer/environment I get the list of packages installed on the server's virtualenv. It makes debugging a whole lot easier.
20th Dec 2017, 10:25 AM
James16
James16 - avatar
+ 3
Конечно, многое пока тёмный лес, но разберусь!
20th Dec 2017, 11:00 AM
Aland
Aland - avatar
+ 3
What mean ""%s==%s""?
20th Dec 2017, 11:07 AM
Aland
Aland - avatar
+ 2
Thank you!
20th Dec 2017, 10:55 AM
Aland
Aland - avatar
+ 2
Спасибо
20th Dec 2017, 10:55 AM
Aland
Aland - avatar
+ 2
Thanks!
20th Dec 2017, 11:20 AM
Aland
Aland - avatar