{"id":2788,"date":"2025-08-12T05:41:57","date_gmt":"2025-08-12T02:41:57","guid":{"rendered":"http:\/\/csnotes.ru\/?p=2788"},"modified":"2025-08-12T05:41:57","modified_gmt":"2025-08-12T02:41:57","slug":"%d0%b3%d0%b8%d0%b1%d0%ba%d0%be%d0%b5-%d1%83%d0%bf%d1%80%d0%b0%d0%b2%d0%bb%d0%b5%d0%bd%d0%b8%d0%b5-%d1%81%d0%be%d0%b4%d0%b5%d1%80%d0%b6%d0%b8%d0%bc%d1%8b%d0%bc-sys-path-%d0%b4%d0%bb%d1%8f-%d1%80","status":"publish","type":"post","link":"https:\/\/csnotes.ru\/?p=2788","title":{"rendered":"\u0413\u0438\u0431\u043a\u043e\u0435 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u044b\u043c sys.path() \u0434\u043b\u044f \u0440\u0430\u0437\u043d\u044b\u0445 \u0441\u0440\u0435\u0434 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">\u041f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u043a\u043e\u0434\u0430 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0432 \u0440\u0430\u0437\u043d\u044b\u0445 \u0441\u0440\u0435\u0434\u0430\u0445 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 (Jupyter, VSCode \u0438 \u0442.\u0434.) \u043c\u043e\u0436\u0435\u0442 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u0443\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 &#8220;\u0441\u043b\u043e\u043c\u0430\u043d\u043d\u044b\u0445&#8221; \u043f\u0443\u0442\u0435\u0439 \u0438 \u0438\u043c\u043f\u043e\u0440\u0442\u043e\u0432. \u041f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0438\u0445 \u0432\u0440\u0443\u0447\u043d\u0443\u044e. \u042d\u0442\u043e \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u043e \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0432 \u043a\u043e\u043c\u0430\u043d\u0434\u0435, \u0435\u0441\u043b\u0438 \u043a\u043e\u0434 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0442\u043e \u0432 \u043e\u0434\u043d\u043e\u0439 \u0441\u0440\u0435\u0434\u0435, \u0442\u043e \u0432 \u0434\u0440\u0443\u0433\u043e\u0439.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u0414\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u044d\u0442\u043e\u0439 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0442\u0440\u044e\u043a \u0441 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u044b\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0441\u0440\u0435\u0434\u044b sys.path().<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0432 Jupyter \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u043e\u0432\u0430\u043d\u043e \u043d\u0430\u0447\u0438\u043d\u0430\u0442\u044c \u0441 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 \/starter. \u0410 \u0441\u0440\u0435\u0434\u0430 VSCode \u043e\u0431\u044b\u0447\u043d\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u0438\u0437 \u043a\u043e\u0440\u043d\u044f \u043f\u0440\u043e\u0435\u043a\u0442\u0430.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import os\nimport sys\n\n# For Jupyter Hub\nif os.getcwd().endswith(\"starter\"): # \u041f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c, \u0437\u0430\u043a\u0430\u043d\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043b\u0438 \u0442\u0435\u043a\u0443\u0449\u0430\u044f \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044f \u043d\u0430 \/starter\n    sys.path.append('..\/library\/')  # \u0434\u043e\u0431\u0430\u0432\u044c \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e path \u043f\u0443\u0442\u044c \"..\/library\/\"\n    sys.path.append('..\/')          # \u0434\u043e\u0431\u0430\u0432\u044c \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e path \u043f\u0443\u0442\u044c \"..\/\"\n\n# For VSCode\nelse:\n    sys.path.append('.\/library\/')   # \u0434\u043e\u0431\u0430\u0432\u044c \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e path \u043f\u0443\u0442\u044c \".\/library\/\"\n    sys.path.append('.\/starter\/')   # \u0434\u043e\u0431\u0430\u0432\u044c \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e path \u043f\u0443\u0442\u044c \"..\/starter\/\"<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 sys.path() \u0432\u0441\u0435\u0433\u0434\u0430 \u0431\u0443\u0434\u0443\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c\u0441\u044f \u043d\u0443\u0436\u043d\u044b\u0435 \u043f\u0443\u0442\u0438.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u041f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u043a\u043e\u0434\u0430 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0432 \u0440\u0430\u0437\u043d\u044b\u0445 \u0441\u0440\u0435\u0434\u0430\u0445 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 (Jupyter, VSCode \u0438 \u0442.\u0434.) \u043c\u043e\u0436\u0435\u0442 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u0443\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 &#8220;\u0441\u043b\u043e\u043c\u0430\u043d\u043d\u044b\u0445&#8221; \u043f\u0443\u0442\u0435\u0439 \u0438 \u0438\u043c\u043f\u043e\u0440\u0442\u043e\u0432. \u041f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0438\u0445 \u0432\u0440\u0443\u0447\u043d\u0443\u044e. \u042d\u0442\u043e \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u043e \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0432 \u043a\u043e\u043c\u0430\u043d\u0434\u0435, \u0435\u0441\u043b\u0438 \u043a\u043e\u0434 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0442\u043e \u0432 \u043e\u0434\u043d\u043e\u0439 \u0441\u0440\u0435\u0434\u0435, \u0442\u043e \u0432 \u0434\u0440\u0443\u0433\u043e\u0439. \u0414\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u044d\u0442\u043e\u0439 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0442\u0440\u044e\u043a \u0441 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u044b\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0441\u0440\u0435\u0434\u044b sys.path(). \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,24,43],"tags":[125],"class_list":["post-2788","post","type-post","status-publish","format-standard","hentry","category-python","category-tech","category-scrypts","tag-sys-path"],"views":117,"_links":{"self":[{"href":"https:\/\/csnotes.ru\/index.php?rest_route=\/wp\/v2\/posts\/2788","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/csnotes.ru\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/csnotes.ru\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/csnotes.ru\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/csnotes.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2788"}],"version-history":[{"count":1,"href":"https:\/\/csnotes.ru\/index.php?rest_route=\/wp\/v2\/posts\/2788\/revisions"}],"predecessor-version":[{"id":2790,"href":"https:\/\/csnotes.ru\/index.php?rest_route=\/wp\/v2\/posts\/2788\/revisions\/2790"}],"wp:attachment":[{"href":"https:\/\/csnotes.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2788"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/csnotes.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2788"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/csnotes.ru\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2788"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}