{"id":456,"date":"2015-07-26T22:32:11","date_gmt":"2015-07-26T13:32:11","guid":{"rendered":"http:\/\/www.typea.info\/blog\/index.php\/2015\/07\/26\/python_windows_virtualenv_tcl\/"},"modified":"2015-07-26T22:32:11","modified_gmt":"2015-07-26T13:32:11","slug":"python_windows_virtualenv_tcl","status":"publish","type":"post","link":"https:\/\/www.typea.info\/blog\/index.php\/2015\/07\/26\/python_windows_virtualenv_tcl\/","title":{"rendered":"Python Windows\u74b0\u5883 VirtualEnv \u3067 tcl \u30e9\u30a4\u30d6\u30e9\u30ea\u304c\u898b\u3064\u304b\u3089\u306a\u3044\u30a8\u30e9\u30fc\u306e\u5bfe\u51e6"},"content":{"rendered":"<p><a href=\"http:\/\/www.amazon.co.jp\/gp\/product\/B00H372KEC\/ref=as_li_ss_il?ie=UTF8&amp;camp=247&amp;creative=7399&amp;creativeASIN=B00H372KEC&amp;linkCode=as2&amp;tag=typea09-22\"><img decoding=\"async\" border=\"0\" src=\"http:\/\/ws-fe.amazon-adsystem.com\/widgets\/q?_encoding=UTF8&amp;ASIN=B00H372KEC&amp;Format=_SL160_&amp;ID=AsinImage&amp;MarketPlace=JP&amp;ServiceVersion=20070822&amp;WS=1&amp;tag=typea09-22\" \/><\/a><img loading=\"lazy\" decoding=\"async\" style=\"border-top-style: none !important; border-bottom-style: none !important; border-right-style: none !important; margin: 0px; border-left-style: none !important\" border=\"0\" alt=\"\" src=\"http:\/\/ir-jp.amazon-adsystem.com\/e\/ir?t=typea09-22&amp;l=as2&amp;o=9&amp;a=B00H372KEC\" width=\"1\" height=\"1\" \/>   <\/p>\n<h2>1.\u75c7\u72b6<\/h2>\n<p>VirtualEnv\u3067\u306f\u306a\u3044\u74b0\u5883\u3067\u3001\u4ee5\u4e0b\u3092\u5b9f\u884c\u3059\u308b\u3068\u3001<\/p>\n<pre class=\"prettyprint linenums\">c:\\&gt;python\r\nPython 2.7.9 (default, Dec 10 2014, 12:28:03) [MSC v.1500 64 bit (AMD64)] on win32\r\nType &quot;help&quot;, &quot;copyright&quot;, &quot;credits&quot; or &quot;license&quot; for more information.\r\n&gt;&gt;&gt; import turtle\r\n&gt;&gt;&gt; turtle.forward(100)\r\n&gt;&gt;&gt;<\/pre>\n<p>\u30a6\u30a3\u30f3\u30c9\u30a6\u304c\u7acb\u3061\u4e0a\u304c\u308a\u3001\u7dda\u304c\u63cf\u753b\u3055\u308c\u308b\u304c\u3001<\/p>\n<p><a href=\"https:\/\/www.typea.info\/blog\/wp-content\/uploads\/image\/6b7decf4332f_1395B\/python_vent_tcl_err01.jpg\"><img loading=\"lazy\" decoding=\"async\" title=\"python_vent_tcl_err01\" style=\"border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px\" border=\"0\" alt=\"python_vent_tcl_err01\" src=\"https:\/\/www.typea.info\/blog\/wp-content\/uploads\/image\/6b7decf4332f_1395B\/python_vent_tcl_err01_thumb.jpg\" width=\"408\" height=\"206\" \/><\/a><\/p>\n<p>VirtualEnv\u74b0\u5883\u3067\u3053\u308c\u3092\u3084\u308b\u3068\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u3001Can&#8217;t find a usable init.tcl \u30a8\u30e9\u30fc\u3068\u306a\u3063\u3066\u3057\u307e\u3046\u3002<\/p>\n<pre class=\"prettyprint linenums\">(math_env) C:\\Programs\\venv\\math_env\\Scripts&gt;python\r\nPython 2.7.9 (default, Dec 10 2014, 12:28:03) [MSC v.1500 64 bit (AMD64)] on win32\r\nType &quot;help&quot;, &quot;copyright&quot;, &quot;credits&quot; or &quot;license&quot; for more information.\r\n&gt;&gt;&gt; import turtle\r\n&gt;&gt;&gt; turtle.forward(10)\r\nTraceback (most recent call last):\r\n  File &quot;<stdin>&quot;, line 1, in <module>\r\n  File &quot;<string>&quot;, line 1, in forward\r\n  File &quot;C:\\python27\\Lib\\lib-tk\\turtle.py&quot;, line 3714, in _getpen\r\n    Turtle._pen = Turtle()\r\n  File &quot;C:\\python27\\Lib\\lib-tk\\turtle.py&quot;, line 3703, in __init__\r\n    Turtle._screen = Screen()\r\n  File &quot;C:\\python27\\Lib\\lib-tk\\turtle.py&quot;, line 3552, in Screen\r\n    Turtle._screen = _Screen()\r\n  File &quot;C:\\python27\\Lib\\lib-tk\\turtle.py&quot;, line 3568, in __init__\r\n    _Screen._root = self._root = _Root()\r\n  File &quot;C:\\python27\\Lib\\lib-tk\\turtle.py&quot;, line 458, in __init__\r\n    TK.Tk.__init__(self)\r\n  File &quot;C:\\python27\\Lib\\lib-tk\\Tkinter.py&quot;, line 1810, in __init__\r\n    self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)\r\n_tkinter.TclError: Can't find a usable init.tcl in the following directories:\r\n    C:\/python27\/lib\/tcl8.5 C:\/Programs\/venv\/math_env\/lib\/tcl8.5 C:\/Programs\/venv\/lib\/tcl8.5 C:\/Programs\/venv\/math_env\/li\r\nbrary C:\/Programs\/venv\/library C:\/Programs\/venv\/tcl8.5.15\/library C:\/Programs\/tcl8.5.15\/library\r\n\r\n\r\n\r\nThis probably means that Tcl wasn't installed properly.<\/pre>\n<h2>2.\u5bfe\u51e6<\/h2>\n<p><a title=\"http:\/\/stackoverflow.com\/questions\/15884075\/tkinter-in-a-virtualenv\" href=\"http:\/\/stackoverflow.com\/questions\/15884075\/tkinter-in-a-virtualenv\">http:\/\/stackoverflow.com\/questions\/15884075\/tkinter-in-a-virtualenv<\/a><\/p>\n<p>VirtualEnv Script \u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306e activate.bat \u306b\u3001\u4ee5\u4e0b\u3092\u8ffd\u8a18<\/p>\n<p>set &quot;TCL_LIBRARY=C:\\Python27\\tcl\\tcl8.5&quot; (\u30d1\u30b9\u306f\u5b9f\u969b\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u30d1\u30b9\u3092\u6307\u5b9a)<\/p>\n<pre class=\"prettyprint linenums\">@echo off\r\nset &quot;VIRTUAL_ENV=C:\\Programs\\venv\\math_env&quot;\r\n\r\nif defined _OLD_VIRTUAL_PROMPT (\r\n    set &quot;PROMPT=%_OLD_VIRTUAL_PROMPT%&quot;\r\n) else (\r\n    if not defined PROMPT (\r\n        set &quot;PROMPT=$P$G&quot;\r\n    )\r\n\tset &quot;_OLD_VIRTUAL_PROMPT=%PROMPT%&quot;\t\r\n)\r\nset &quot;PROMPT=(math_env) %PROMPT%&quot;\r\n\r\nif not defined _OLD_VIRTUAL_PYTHONHOME (\r\n    set &quot;_OLD_VIRTUAL_PYTHONHOME=%PYTHONHOME%&quot;\r\n)\r\nset PYTHONHOME=\r\n\r\nif defined _OLD_VIRTUAL_PATH (\r\n    set &quot;PATH=%_OLD_VIRTUAL_PATH%&quot;\r\n) else (\r\n    set &quot;_OLD_VIRTUAL_PATH=%PATH%&quot;\r\n)\r\nset &quot;PATH=%VIRTUAL_ENV%\\Scripts;%PATH%&quot;\r\nset &quot;TCL_LIBRARY=C:\\Python27\\tcl\\tcl8.5&quot;\r\n:END<\/pre>\n<h2>3.\u7d50\u679c<\/h2>\n<p>\u30bf\u30fc\u30c8\u30eb\u30b0\u30e9\u30d5\u30a3\u30c3\u30af\u304c\u66f8\u304d\u305f\u304b\u3063\u305f\u308f\u3051\u3067\u306f\u306a\u304f\u3066\u3001<a href=\"http:\/\/typea.info\/tips\/wiki.cgi?page=Python+matplotlib\">matplotlib<\/a> \u306e\u30b0\u30e9\u30d5\u753b\u9762\u3060\u305d\u3046\u3068\u3057\u305f\u3089\u3001\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3002\u5bfe\u51e6\u3057\u305f\u3089\u3001\u30b0\u30e9\u30d5\u753b\u9762\u304c\u8868\u793a\u3055\u308c\u308b\u3088\u3046\u306b\u306a\u3063\u305f\u3002<\/p>\n<p><a href=\"https:\/\/www.typea.info\/blog\/wp-content\/uploads\/image\/6b7decf4332f_1395B\/python_vent_tcl_err02.jpg\"><img loading=\"lazy\" decoding=\"async\" title=\"python_vent_tcl_err02\" style=\"border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px\" border=\"0\" alt=\"python_vent_tcl_err02\" src=\"https:\/\/www.typea.info\/blog\/wp-content\/uploads\/image\/6b7decf4332f_1395B\/python_vent_tcl_err02_thumb.jpg\" width=\"398\" height=\"278\" \/><\/a><\/p>\n<p>\u3081\u3067\u305f\u3057\u3081\u3067\u305f\u3057\u3002<\/p>\n<h2>4.Eclipse + PyDev \u306e\u5bfe\u51e6<\/h2>\n<p>\u3068\u3001\u601d\u3063\u305f\u304c\u3001PyDev \u3067\u8a66\u3057\u305f\u3089\u540c\u69d8\u306e\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3002Window \u2013 Preference \u304b\u3089\u3001PyDev \u2013 Interpreters \u30fc Python Interpreter \u306e Environment \u306b\u3001TCL_LIBRARY \u3092\u8a2d\u5b9a<\/p>\n<p><a href=\"https:\/\/www.typea.info\/blog\/wp-content\/uploads\/image\/6b7decf4332f_1395B\/python_vent_tcl_err03.jpg\"><img loading=\"lazy\" decoding=\"async\" title=\"python_vent_tcl_err03\" style=\"border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px\" border=\"0\" alt=\"python_vent_tcl_err03\" src=\"https:\/\/www.typea.info\/blog\/wp-content\/uploads\/image\/6b7decf4332f_1395B\/python_vent_tcl_err03_thumb.jpg\" width=\"357\" height=\"282\" \/><\/a><\/p>\n<p>&#160;<\/p>\n<pre class=\"prettyprint linenums\">import numpy as np\r\nimport matplotlib.pyplot as plt\r\nimport random\r\n\r\nrandom_data = [random.randrange(0,10) for x in range(10)]\r\nfig,ax = plt.subplots()\r\nax.bar(np.arange(10),random_data,1)\r\nplt.show()<\/pre>\n<p>&#160;<\/p>\n<p><a href=\"https:\/\/www.typea.info\/blog\/wp-content\/uploads\/image\/6b7decf4332f_1395B\/python_vent_tcl_err04.jpg\"><img loading=\"lazy\" decoding=\"async\" title=\"python_vent_tcl_err04\" style=\"border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px\" border=\"0\" alt=\"python_vent_tcl_err04\" src=\"https:\/\/www.typea.info\/blog\/wp-content\/uploads\/image\/6b7decf4332f_1395B\/python_vent_tcl_err04_thumb.jpg\" width=\"437\" height=\"326\" \/><\/a><\/p>\n<p>OK! PyDev\u304b\u3089\u3082\u52d5\u304d\u307e\u3057\u305f\u3088\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>1.\u75c7\u72b6 VirtualEnv\u3067\u306f\u306a\u3044\u74b0\u5883\u3067\u3001\u4ee5\u4e0b\u3092\u5b9f\u884c\u3059\u308b\u3068\u3001 c:\\&gt;python Python 2.7.9 (default, Dec 10 2014, 12:28:03) [MSC v.1500 64 bi [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"sns_share_botton_hide":"","vkExUnit_sns_title":"","_vk_print_noindex":"","sitemap_hide":"","_veu_custom_css":"","veu_display_promotion_alert":"","vkexunit_cta_each_option":"","footnotes":""},"categories":[20],"tags":[],"class_list":["post-456","post","type-post","status-publish","format-standard","hentry","category-python"],"veu_head_title_object":{"title":"","add_site_title":""},"_links":{"self":[{"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/posts\/456","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/comments?post=456"}],"version-history":[{"count":0,"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/posts\/456\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/media?parent=456"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/categories?post=456"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/tags?post=456"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}