2011-11-10 19 views
10

मुझे 64 बिट पायथन 2.7 पायविन 32 मॉड्यूल (ऑपरेटिंग सिस्टम विंडोज 7 64 बिट) के साथ वर्चुअलएन्व पर स्थापित करने का सही तरीका है।
मुझे Sourceforge पर exe इंस्टॉलर मिला है।पायथन 2.7 64 बिट के साथ वर्चुअलएन्व में pywin32 कैसे स्थापित करें?

जब मैं कमांड लाइन पर easy_installer चलाता हूं तो सब ठीक हो जाता है लेकिन जल्द ही मुझे अजीब व्यवहार दिखाई देता है: जबकि pywin32-216.win-amd64-py2.7 इंस्टॉल करता है यह pywin32-216-py2.7-win32.egg चलाता है और यह त्रुटि के साथ विफल:

No local packages or download links found for pywin32==216 
Best match: None 

और यहाँ मेरा पूरा लॉग है:

(sandbox_virtenv) D:\test\py2exe_test>easy_install http://sourceforge.net/projects/pywin32/files/pywin32/Build216/pywin32-216.win-amd64-py2.7.exe 
Downloading http://sourceforge.net/projects/pywin32/files/pywin32/Build216/pywin32-216.win-amd64-py2.7.exe 
Processing pywin32-216.win-amd64-py2.7.exe 
pywintypes: module references __file__ 
win32evtlogutil: module references __file__ 
win32serviceutil: module references __file__ 
win32timezone: module references __file__ 
Demos.win32rcparser_demo: module references __file__ 
Demos.security.sspi.validate_password: module references __file__ 
isapi.install: module references __file__ 
isapi.samples.advanced: module references __file__ 
isapi.samples.test: module references __file__ 
isapi.test.setup: module references __file__ 
pywin.framework.scriptutils: module references __file__ 
pywin.framework.startup: module references __path__ 
pywin.scintilla.config: module references __path__ 
pywin.scintilla.control: module references __file__ 
pywin.scintilla.IDLEenvironment: module references __file__ 
scripts.regsetup: module references __file__ 
scripts.setup_d: module references __file__ 
test.testall: module references __file__ 
test.test_clipboard: module references __file__ 
test.test_win32api: module references __file__ 
test.test_win32rcparser: module references __file__ 
D:\test\sandbox_virtenv\lib\site-packages\setuptools-0.6c11-py2.7.egg\setuptools\command\bdist_egg.py:422: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal 
    symbols = dict.fromkeys(iter_symbols(code)) 
test.test_win32trace: module references __file__ 
win32com.__init__: module references __path__ 
win32com.server.register: module references __file__ 
win32com.server.register: module references __path__ 
win32com.test.GenTestScripts: module references __path__ 
win32com.test.pippo_server: module references __file__ 
win32com.test.testall: module references __file__ 
win32com.test.testAXScript: module references __path__ 
win32com.test.testDictionary: module references __file__ 
win32com.test.testPippo: module references __file__ 
win32com.test.testPyComTest: module references __file__ 
win32com.test.testServers: module references __file__ 
win32com.test.util: module references __file__ 
win32comext.adsi.__init__: module references __path__ 
win32comext.authorization.__init__: module references __path__ 
win32comext.axcontrol.__init__: module references __path__ 
win32comext.axdebug.codecontainer: module references __file__ 
win32comext.axdebug.debugger: module references __file__ 
win32comext.axdebug.__init__: module references __path__ 
win32comext.axscript.__init__: module references __path__ 
win32comext.bits.__init__: module references __path__ 
win32comext.directsound.__init__: module references __path__ 
win32comext.directsound.test.ds_test: module references __file__ 
win32comext.internet.__init__: module references __path__ 
win32comext.mapi.__init__: module references __path__ 
win32comext.shell.__init__: module references __path__ 
win32comext.shell.demos.servers.empty_volume_cache: module references __file__ 
win32comext.shell.demos.servers.folder_view: module references __file__ 
win32comext.taskscheduler.__init__: module references __path__ 
creating 'c:\users\antp~1.kyi\appdata\local\temp\easy_install-kclmxk\pywin32-216-py2.7-win32.egg' and adding 'c:\users\antp~1.kyi\appdata\local\temp\easy_install-kclmxk\pywin32-216-py2.7-win32.egg.tmp' to it 
creating d:\test\sandbox_virtenv\lib\site-packages\pywin32-216-py2.7-win32.egg 
Extracting pywin32-216-py2.7-win32.egg to d:\test\sandbox_virtenv\lib\site-packages 
Adding pywin32 216 to easy-install.pth file 
Installing pywin32_postinstall.py script to D:\test\sandbox_virtenv\Scripts 
Installing pywin32_postinstall.pyc script to D:\test\sandbox_virtenv\Scripts 
Installing pywin32_testall.py script to D:\test\sandbox_virtenv\Scripts 
Installing pywin32_testall.pyc script to D:\test\sandbox_virtenv\Scripts 

Installed d:\test\sandbox_virtenv\lib\site-packages\pywin32-216-py2.7-win32.egg 
Processing dependencies for pywin32==216 
Searching for pywin32==216 
Reading http://pypi.python.org/simple/pywin32/ 
Reading http://sf.net/projects/pywin32 
Reading https://sourceforge.net/projects/pywin32/files/pywin32/ 
Reading http://sourceforge.net/project/showfiles.php?group_id=78018 
No local packages or download links found for pywin32==216 
Best match: None 
Traceback (most recent call last): 
    File "D:\test\sandbox_virtenv\Scripts\easy_install-script.py", line 8, in <module> 
    load_entry_point('setuptools==0.6c11', 'console_scripts', 'easy_install')() 
    File "D:\test\sandbox_virtenv\lib\site-packages\setuptools-0.6c11-py2.7.egg\setuptools\command\easy_install.py", line 1712, in main 
    with_ei_usage(lambda: 
    File "D:\test\sandbox_virtenv\lib\site-packages\setuptools-0.6c11-py2.7.egg\setuptools\command\easy_install.py", line 1700, in with_ei_usage 
    return f() 
    File "D:\test\sandbox_virtenv\lib\site-packages\setuptools-0.6c11-py2.7.egg\setuptools\command\easy_install.py", line 1716, in <lambda> 
    distclass=DistributionWithoutHelpCommands, **kw 
    File "c:\Python27\Lib\distutils\core.py", line 152, in setup 
    dist.run_commands() 
    File "c:\Python27\Lib\distutils\dist.py", line 953, in run_commands 
    self.run_command(cmd) 
    File "c:\Python27\Lib\distutils\dist.py", line 972, in run_command 
    cmd_obj.run() 
    File "D:\test\sandbox_virtenv\lib\site-packages\setuptools-0.6c11-py2.7.egg\setuptools\command\easy_install.py", line 211, in run 
    self.easy_install(spec, not self.no_deps) 
    File "D:\test\sandbox_virtenv\lib\site-packages\setuptools-0.6c11-py2.7.egg\setuptools\command\easy_install.py", line 422, in easy_install 
    return self.install_item(None, download, tmpdir, deps, True) 
    File "D:\test\sandbox_virtenv\lib\site-packages\setuptools-0.6c11-py2.7.egg\setuptools\command\easy_install.py", line 478, in install_item 
    self.process_distribution(spec, dist, deps) 
    File "D:\test\sandbox_virtenv\lib\site-packages\setuptools-0.6c11-py2.7.egg\setuptools\command\easy_install.py", line 519, in process_distribution 
    [requirement], self.local_index, self.easy_install 
    File "D:\test\sandbox_virtenv\lib\site-packages\setuptools-0.6c11-py2.7.egg\pkg_resources.py", line 563, in resolve 
    dist = best[req.key] = env.best_match(req, self, installer) 
    File "D:\test\sandbox_virtenv\lib\site-packages\setuptools-0.6c11-py2.7.egg\pkg_resources.py", line 799, in best_match 
    return self.obtain(req, installer) # try and download/install 
    File "D:\test\sandbox_virtenv\lib\site-packages\setuptools-0.6c11-py2.7.egg\pkg_resources.py", line 811, in obtain 
    return installer(requirement) 
    File "D:\test\sandbox_virtenv\lib\site-packages\setuptools-0.6c11-py2.7.egg\setuptools\command\easy_install.py", line 434, in easy_install 
    self.local_index 
    File "D:\test\sandbox_virtenv\lib\site-packages\setuptools-0.6c11-py2.7.egg\setuptools\package_index.py", line 475, in fetch_distribution 
    return dist.clone(location=self.download(dist.location, tmpdir)) 
AttributeError: 'NoneType' object has no attribute 'clone' 

(sandbox_virtenv) D:\test\py2exe_test> 

अब मैं अजगर win32api से आयात कर सकते हैं और यह काफी भ्रामक है

(sandbox_virtenv) D:\test\py2exe_test>python 
Python 2.7.2 (default, Jun 12 2011, 14:24:46) [MSC v.1500 64 bit (AMD64)] on win32 
Type "help", "copyright", "credits" or "license" for more information. 
>>> import win32api 
>>> 

यदि आप यहां कुछ अस्पष्ट मुझसे पूछते हैं तो मुझसे पूछें। आपकी सलाह के लिए धन्यवाद।

उत्तर

9

मैंने इसे समझ लिया, लेकिन प्रक्रिया सुखद नहीं है।

PyWin32 इंस्टालर के साथ 3 समस्याएं हैं:

  1. यह अपने अजगर रजिस्ट्री से बाहर स्थान स्थापित पढ़ने।
  2. Is मानता है कि आपके lib निर्देशिका निर्देशिका python.exe
  3. यह% windir% \ system32

तो करने के लिए 3 DLLs उदासीनता आप 64 बिट अजगर 2 चला रहे हैं युक्त का एक बच्चा है।64 बिट विंडोज़ या 32 32 पर और अपने आभासी पर्यावरण पर 7 सी में है:

  1. कॉपी python.exe और pythonw.exe ग से:: \ खरोंच \ env1 \ \ खरोंच \ env1 \ प्रक्रिया इस तरह दिखता है सी के लिए स्क्रिप्ट: \ scratch \ env1
  2. रजिस्ट्री कुंजी HKLM \ सॉफ़्टवेयर \ पायथन \ PythonCore \ 2.7 \ InstallPath \ "c: \ scratch \ env1 \" में मान "(डिफ़ॉल्ट)" अद्यतन करें (सुनिश्चित करें कि आप रिकॉर्ड करते हैं पुराना मान।)
  3. कमांड लाइन से, जहां आपने वर्चुअल वातावरण को सक्रिय किया है, इंस्टॉलर.एक्सई को सीधे चलाकर PyWin32 इंस्टॉल करें। Easy_install का उपयोग न करें। \ खरोंच \ env1 \
  4. कदम pythoncom27.dll, pywintypes27.dll और% WINDIR से pythoncomloader27.dll:
  5. ग से मूल मूल्य
  6. हटाएं python.exe और pythonw.exe को वापस InstallPath रजिस्ट्री कुंजी सेट % \ system32 \ ग: \ खरोंच \ env1 \ (python27.dll हिलना मत या आप इसे पछतावा होगा) होने pywin32 के बाहर स्थापित बिना

यह अच्छी तरह से आभासी वातावरण में Django-mssql चलाने के लिए पर्याप्त काम करता है आभासी पर्यावरण का।

+0

चरण 3 में कमांडलाइन को व्यवस्थापक के रूप में लॉन्च किया जाना चाहिए अन्यथा PyWin32 त्रुटियों के साथ समाप्त हो जाएगा –

+0

जब मैं चरण 6 करता हूं तो मुझे आयात करें Win32service के रूप में आयात करें। मैं चरण 6 करता हूं। ग्रहण में odoo डीबग लॉन्च करने का प्रयास करते समय। मुझे लगता है कि यह कदम नहीं किया जाना चाहिए। –

2

दुर्भाग्य से, विंडोज़ पर 64 बिट पायथन के लिए समर्थन 32 बिट संस्करण से अपेक्षाकृत खराब है। यह पायथन समुदाय की गलती नहीं है लेकिन 64 बिट विंडोज के लिए मुफ्त कंपाइलर्स प्राप्त करने में सापेक्ष कठिनाई है।

यदि आपने पायथन के 64 बिट संस्करण को स्थापित किया है, तो आपको 64 बिट के लिए बनाए गए संकुल का उपयोग करने की भी आवश्यकता है। कुछ सरल पायथन पैकेज (जो शुद्ध पायथन में लिखे गए हैं और बाहरी/सी पुस्तकालयों की आवश्यकता नहीं है) setuptools/easy_install/virtualenv का उपयोग करके सामान्य के रूप में स्थापित करेंगे। वर्चुअलएन्व में स्थापित होने पर बहुत सारे 64 बिट पैकेज तोड़ सकते हैं और इंस्टॉलर की आवश्यकता होगी।

सौभाग्य से, आप लोकप्रिय पैकेज here के लिए 64 बिट प्री-कंपाइल इंस्टॉलर पा सकते हैं। पहले पैकेज को आजमाएं। इंस्टॉलर पाइथन की वैश्विक/मुख्य स्थापना को लक्षित करेगा और इस प्रकार वर्चुअलएन्व द्वारा अलग नहीं किया जाएगा। ध्यान दें कि ये अनौपचारिक बनाता है: आपकी सुविधा के लिए मुफ्त में प्रदान किया गया है, इसलिए यदि चीजें विफल हो जाती हैं (या मदद की उम्मीद है) तो प्रदाता पर मुकदमा न करें।

+0

प्रतिक्रिया के लिए धन्यवाद है। जब मैं इसे easy_installer को देता हूं तो इंस्टॉलर भी एक ही त्रुटि का कारण बनता है। यह दुख की बात है। – tony

+0

.exe इंस्टॉलर का उपयोग/लॉन्च करें (क्लिक-क्लिक प्रक्रिया), easy_install का उपयोग न करें। मुझे 216/हालिया बिल्ड बनाने के बारे में निश्चित नहीं है, लेकिन मैं बिना किसी समस्या के कुछ महीने पहले विंडोज 7 में पाइथन 2.7 64 बिट पर 64 बिट पायविन 32 स्थापित करने में सक्षम था। मुझे बताएं कि यह अभी भी काम नहीं करता है ... शायद हमें अन्य बग ट्रैकर को देखने की ज़रूरत है यदि अन्य लोगों के पास एक ही समस्या है। – shimofuri

+0

हाँ, बिना किसी अतिरिक्त उपकरण के इंस्टॉलेशन ठीक काम करता है लेकिन मैं केवल इस वर्चुअल वातावरण पर इस एक्सटेंशन को इंस्टॉलेशन की तलाश में था, मैं इसे अपने वैश्विक पायथन इंस्टॉलेशन पर नहीं चाहता हूं। – tony

4

नवीनतम वर्चुअलएव-1.7.1.2 के साथ, वर्चुअलएव को --distribute ध्वज के साथ बनाने का प्रयास करें। मैं ध्वज जोड़कर आपके द्वारा की गई वही समस्या को हल करने में कामयाब रहा।

एक संबंधित नोट पर, एक और मशीन पर (एक ही ओएस, Windows Server 2008 R2), मैं बिना --distribute झंडा virtualenv बनाने के लिए नहीं तो जब भी मैं easy_install चलाने एक नया कमांड प्रॉम्प्ट खुला पॉप जाएगा था।

विंडोज़ पर वर्चुअलएन्व एक अंधेरे कला की तरह है।

+0

मुझे लगता है कि '--distribute' ध्वज बहिष्कृत है और अब कुछ भी नहीं करता है। – qris

2

यह एक पुराना सवाल है, लेकिन हाल ही में इस समस्या में आ गया है और मैं यह काम करने के लिए मैंने जो किया है उसे साझा करना चाहता हूं। मैं विंडोज़ पर पाइथन केर्बेरोज कार्यान्वयन की तलाश में था, और मुझे kerbeors_sspi मिला जो pywin32 का उपयोग करता है। यह सब पाइप का उपयोग करके स्थापित किया गया है, लेकिन वर्चुअलनेव के अंदर पाइप का उपयोग करके pywin32 इंस्टॉल नहीं किया जा सकता है।

इसलिए मैंने kyberos_sspi लाइब्रेरी को pypiwin32 का उपयोग करने के लिए पैच किया, जो कि ग्लाइफ और एल (ट्विस्ट निर्माता बीटीडब्लू) द्वारा पैक किया गया एक पहिया है। और अब यह सब अद्भुत काम करता है, फिर भी यदि आप COM सामानों को एक्सेस करना चाहते हैं तो आपको मैन्युअल रूप से pywin32 इंस्टॉल करना होगा क्योंकि इसे सिस्टम के साथ पंजीकृत होना आवश्यक है।

यहाँ pypiwin32 index

चियर्स के लिए लिंक,

संबंधित मुद्दे