{"rsdb":{"rid":"243074","subhead":"","postdate":"0","aid":"167336","fid":"77","uid":"1","topic":"1","content":"
\n

\u3000\u3000\u4e94\u5206\u949f\u8f7b\u677e\u5b66\u4f1a\u7ba1\u7406\u9879\u76ee\u5f00\u53d1\u73af\u5883\u3002<\/p> \n

\u3000\u3000\u5728\u5f00\u53d1Python\u5e94\u7528\u7a0b\u5e8f\u7684\u65f6\u5019\uff0c\u7cfb\u7edf\u5b89\u88c5\u7684Python3\u53ea\u6709\u4e00\u4e2a\u7248\u672c\uff1a3.x\u3002\u6240\u6709\u7b2c\u4e09\u65b9\u7684\u5305\u90fd\u4f1a\u88abpip<\/code>\u5b89\u88c5\u5230Python3\u7684site-packages<\/code>\u76ee\u5f55\u4e0b\u3002<\/p> \n

\u3000\u3000pycharm\u5b89\u88c5\u53ef\u4ee5\u5728\u8bbe\u7f6e\u91cc\u8fdb\u884c\u7ba1\u7406\u3002<\/p> \n

\"\"<\/p> \n

 <\/p> \n

\u3000\u3000\u5982\u679c\u6211\u4eec\u8981\u540c\u65f6\u5f00\u53d1\u591a\u4e2a\u5e94\u7528\u7a0b\u5e8f\uff0c\u6bcf\u4e2a\u5e94\u7528\u53ef\u80fd\u9700\u8981\u5404\u81ea\u62e5\u6709\u4e00\u5957\u201c\u72ec\u7acb\u201d\u7684Python\u8fd0\u884c\u73af\u5883\uff0c\u5c24\u5176\u662fgit\u534f\u8c03\u5f00\u53d1\uff0c\u4e00\u4e2a\u4f7f\u7528django2.0\uff0c\u4e00\u4e2a\u4f7f\u7528django1.x\uff0c\u540c\u65f6\u8fd8\u8981\u5f00\u53d1\u5176\u4ed6\u9879\u76ee\uff0c\u6240\u4ee5\u80fd\u72ec\u7acb\u51fa\u6bcf\u4e2a\u9879\u76ee\u7684\u5f00\u53d1\u73af\u5883\u662f\u5f88\u6709\u5fc5\u8981\u7684\u3002virtualenv\u5c31\u662f\u7528\u6765\u4e3a\u4e00\u4e2a\u5e94\u7528\u521b\u5efa\u4e00\u5957\u201c\u9694\u79bb\u201d\u7684Python\u8fd0\u884c\u73af\u5883\u3002<\/p> \n

\u3000\u3000virtualenv\u7684\u4f18\u70b9\uff1a<\/p> \n

\u3000\u3000\u4f7f\u4e0d\u540c\u7684\u5e94\u7528\u5f00\u53d1\u73af\u5883\u72ec\u7acb\uff1b<\/p> \n

\u3000\u3000\u73af\u5883\u5347\u7ea7\u4e0d\u5f71\u54cd\u5176\u4ed6\u7684\u5e94\u7528\uff0c\u4e5f\u4e0d\u4f1a\u5f71\u54cd\u5168\u5c40\u7684python<\/a>\u5f00\u53d1\u73af\u5883\uff1b<\/p> \n

\u3000\u3000\u5b83\u53ef\u4ee5\u9632\u6b62\u7cfb\u7edf\u4e2d\u51fa\u73b0\u5305\u7ba1\u7406\u6df7\u4e71\u548c\u7248\u672c\u7684\u51b2\u7a81\u3002<\/p> \n

\u5b89\u88c5\u4f7f\u7528virtualenv<\/h1> \n
\n
pip install virtualenv<\/pre> \n <\/div> \n 
\n
C:\\Users\\jeffd>virtualenv testenv#\u65b0\u5efa\u865a\u62df\u73af\u5883\nUsing base prefix <\/span>'<\/span>c:\\\\users\\\\jeffd\\\\appdata\\\\local\\\\programs\\\\python<\/a>\\\\python36-32<\/span>'<\/span>\nNew python executable <\/span>in<\/span> C:\\Users\\jeffd\\testenv\\Scripts\\python.exe\/\/\u9ed8\u8ba4\u5b89\u88c5\u5728\u5f53\u524d\u76ee\u5f55\u4e0b\nInstalling setuptools, pip, wheel...done.<\/span><\/pre> \n <\/div> \n 
\n
C:\\testenv\\Scripts>activate           \/\/\u6fc0\u6d3b\n \n(testenv) C:\\testenv\\Scripts<\/span>>        \/\/\u6ce8\u610f\u7ec8\u7aef\u53d1\u751f\u4e86\u53d8\u5316\n(testenv) C:\\testenv\\Scripts<\/span>>deactivate         \/\/\u5173\u95ed\u5f53\u524d\u865a\u62df\u73af\u5883\nC:\\testenv\\Scripts<\/span>><\/pre> \n <\/div> \n 

 \u3000\u3000\u5728\u6fc0\u6d3b\u7684\u72b6\u6001\u4e0bpip\u7684\u5b89\u88c5\u5305\u90fd\u662f\u5b89\u88c5\u5230C:\\Users\\jeffd\\testenv\\Scripts\u4e0b\uff0c\u53ef\u4ee5\u663e\u793a\u5f53\u524denv\u73af\u5883\u4e0b\u7684\u6240\u6709\u5305\u7684\u7248\u672c\u4fe1\u606f\u3002<\/p> \n

\n
(testenv) C:\\Users\\jeffd\\testenv\\Scripts>pip list\npip (<\/span>9.0.1)\nsetuptools (<\/span>38.2.4)\nwheel (<\/span>0.30.0)<\/pre> \n <\/div> \n 

\u3000\u3000\u52a0\u5f3a\u7248\u672c\uff1avirtualenvwrapper\uff0c\u4ed6\u662fvirtualenv\u7684\u6269\u5c55\u5305\uff0cWindows\u4e0b\u7684\u5b89\u88c5\u64cd\u4f5c\u662f\uff1a<\/p> \n

\n
pip install virtualenvwrapper-win<\/pre> \n <\/div> \n 
\n
c:\\>mkvirtualenv testenv2  \/\/\u521b\u5efa\u865a\u62df\u73af\u5883\n C:\\Users\\jeff\\Envs <\/span>is<\/span> not<\/span> a directory, creating\nUsing base prefix <\/span>'<\/span>c:\\\\python36<\/span>'<\/span>\nNew python executable <\/span>in<\/span> C:\\Users\\jeff\\Envs\\testenv2\\Scripts\\python.exe   \/\/virtualenvwrapper\u9ed8\u8ba4\u4f1a\u628a\u865a\u62df\u73af\u5883\u653e\u5728\u4e00\u4e2a\u76ee\u5f55\u4e0b\nInstalling setuptools, pip, wheel...done.<\/span><\/pre> \n <\/div> \n 
\n
(testenv3) c:\\Users\\jeff\\Envs\\testenv2\\Scripts>workon  \/\/\u67e5\u770b\u5f53\u524d\u6709\u54ea\u4e9b\u865a\u62df\u73af\u5883\n \nPass a name to activate one of the following virtualenvs:\n<\/span>==============================================================================\ntestenv2\ntestenv3\n(testenv3) c:\\Users\\jeff\\Envs\\testenv2\\Scripts<\/span>>workon testenv2  \/\/workon\u4e5f\u53ef\u4ee5\u7528\u6765\u5207\u6362\u865a\u62df\u73af\u5883\n(testenv2) c:\\Users\\jeff\\Envs\\testenv2\\Scripts<\/span>><\/pre> \n <\/div> \n 

\u3000\u3000\u8fd9\u4e2a\u6269\u5c55\u5305\u5bf9\u73af\u5883\u8fdb\u884c\u4e86\u7edf\u4e00\u7ba1\u7406\uff0c\u53ef\u4ee5\u8fdb\u884c\u65e0\u7f1d\u5207\u6362\u5de5\u4f5c\u73af\u5883\uff0c\u975e\u5e38\u7684\u5b9e\u7528\uff0c\u4f60\u95ee\u6211\u600e\u4e48\u7528\uff1f<\/p> \n

\u3000\u3000\u7b2c\u4e00\u6b65\uff0c\u6253\u5f00pycharm\u627e\u5230\u89e3\u91ca\u5668\u8bbe\u7f6e\u7684\u4f4d\u7f6e\uff1a<\/p> \n

\"\"<\/p> \n

\u3000\u3000\u7b2c\u4e8c\u6b65\uff0c\u627e\u5230\u4f60\u521a\u624d\u7684\u914d\u7f6e\u73af\u5883\u7684\u76ee\u5f55\uff1a<\/p> \n

\"\"<\/p> \n

\u3000\u3000\u786e\u8ba4\u5c31\u6210\u529f\u4e86\uff1a<\/p> \n

\"\"<\/p> \n

\u3000\u3000\u6700\u540e\u8981\u8bf4\u4e00\u70b9\uff0c\u6211\u4eec\u5e73\u65f6\u5b89\u88c5\u5305\u90fd\u662f\u4f7f\u7528\u7684\u5b98\u65b9\u7684\u5730\u5740\uff0c\u4e0b\u8f7d\u901f\u5ea6\u5341\u5206\u611f\u4eba\uff0c\u6240\u4ee5\u6211\u627e\u4e86\u4e00\u4e2a\u56fd\u5185\u7684pip\u6e90\uff0c\u67d0\u5ea6\u4e91\u5f00\u6ca1\u5f00\u4f1a\u5458\u7684\u5dee\u8ddd\uff0c\u5730\u5740\u662fhttps:\/\/pypi.tuna.tsinghua.edu.cn\/simple\/\uff0c\u5b89\u88c5\u64cd\u4f5c\uff1a<\/p> \n

\n
pip install xx==\u7248\u672c\u53f7 -i https:\/\/pypi.tuna.tsinghua.edu.cn\/simple\/<\/pre> \n <\/div> \n 

\u3000\u3000\u53ef\u4ee5\u8bf4\u662f\u975e\u5e38\u7684\u7b80\u5355\uff0c\u975e\u5e38\u7684\u5b9e\u7528\uff0c\u6b22\u8fce\u5404\u4f4d\u5927\u4f6c\u6279\u8bc4\u6307\u6b63\u3002<\/p>\n<\/div>","orderid":"0","title":"\u5feb\u901f\u4e0a\u624bvirtualenv","smalltitle":"","mid":"0","fname":"Python","special_id":"0","bak_id":"0","info":"0","hits":"745","pages":"1","comments":"0","posttime":"2017-12-25 06:07:11","list":"1514153231","username":"admin","author":"","copyfrom":"","copyfromurl":"","titlecolor":"","fonttype":"0","titleicon":"0","picurl":"http:\/\/images2017.cnblogs.com\/blog\/1165242\/201712\/1165242-20171224131227303-1055955054.png","ispic":"1","yz":"1","yzer":"","yztime":"0","levels":"0","levelstime":"0","keywords":"\u5feb\u901f<\/A> \u4e0a\u624b<\/A> virtualenv<\/A>","jumpurl":"","iframeurl":"","style":"","template":"a:3:{s:4:\"head\";s:0:\"\";s:4:\"foot\";s:0:\"\";s:8:\"bencandy\";s:0:\"\";}","target":"0","ip":"113.110.148.213","lastfid":"0","money":"0","buyuser":"","passwd":"","allowdown":"","allowview":"","editer":"","edittime":"0","begintime":"0","endtime":"0","description":"\u5feb\u901f\u4e0a\u624bvirtualenv","lastview":"1713999774","digg_num":"0","digg_time":"0","forbidcomment":"0","ifvote":"0","heart":"","htmlname":"","city_id":"0"},"page":"1"}