Python 2.7 - (Library|Module) Installation on 64 bit

> Procedural Languages > Python > Python - Grammar (Package | Module)

1 - Steps

python setup.py install
running install
running bdist_egg
running egg_info
writing requirements to oauth2.egg-info\requires.txt
writing oauth2.egg-info\PKG-INFO
writing top-level names to oauth2.egg-info\top_level.txt
writing dependency_links to oauth2.egg-info\dependency_links.txt
reading manifest file 'oauth2.egg-info\SOURCES.txt'
writing manifest file 'oauth2.egg-info\SOURCES.txt'
installing library code to build\bdist.win-amd64\egg
running install_lib
running build_py
creating build
creating build\lib
creating build\lib\oauth2
copying oauth2\_version.py -> build\lib\oauth2
copying oauth2\__init__.py -> build\lib\oauth2
creating build\lib\tests
copying tests\test_oauth.py -> build\lib\tests
copying tests\__init__.py -> build\lib\tests
creating build\lib\oauth2\clients
copying oauth2\clients\imap.py -> build\lib\oauth2\clients
copying oauth2\clients\smtp.py -> build\lib\oauth2\clients
copying oauth2\clients\__init__.py -> build\lib\oauth2\clients
creating build\bdist.win-amd64
creating build\bdist.win-amd64\egg
creating build\bdist.win-amd64\egg\oauth2
creating build\bdist.win-amd64\egg\oauth2\clients
copying build\lib\oauth2\clients\imap.py -> build\bdist.win-amd64\egg\oauth2\clients
copying build\lib\oauth2\clients\smtp.py -> build\bdist.win-amd64\egg\oauth2\clients
copying build\lib\oauth2\clients\__init__.py -> build\bdist.win-amd64\egg\oauth2\clients
copying build\lib\oauth2\_version.py -> build\bdist.win-amd64\egg\oauth2
copying build\lib\oauth2\__init__.py -> build\bdist.win-amd64\egg\oauth2
creating build\bdist.win-amd64\egg\tests
copying build\lib\tests\test_oauth.py -> build\bdist.win-amd64\egg\tests
copying build\lib\tests\__init__.py -> build\bdist.win-amd64\egg\tests
byte-compiling build\bdist.win-amd64\egg\oauth2\clients\imap.py to imap.pyc
byte-compiling build\bdist.win-amd64\egg\oauth2\clients\smtp.py to smtp.pyc
byte-compiling build\bdist.win-amd64\egg\oauth2\clients\__init__.py to __init__.pyc
byte-compiling build\bdist.win-amd64\egg\oauth2\_version.py to _version.pyc
byte-compiling build\bdist.win-amd64\egg\oauth2\__init__.py to __init__.pyc
byte-compiling build\bdist.win-amd64\egg\tests\test_oauth.py to test_oauth.pyc
byte-compiling build\bdist.win-amd64\egg\tests\__init__.py to __init__.pyc
creating build\bdist.win-amd64\egg\EGG-INFO
copying oauth2.egg-info\PKG-INFO -> build\bdist.win-amd64\egg\EGG-INFO
copying oauth2.egg-info\SOURCES.txt -> build\bdist.win-amd64\egg\EGG-INFO
copying oauth2.egg-info\dependency_links.txt -> build\bdist.win-amd64\egg\EGG-INFO
copying oauth2.egg-info\requires.txt -> build\bdist.win-amd64\egg\EGG-INFO
copying oauth2.egg-info\top_level.txt -> build\bdist.win-amd64\egg\EGG-INFO
copying oauth2.egg-info\zip-safe -> build\bdist.win-amd64\egg\EGG-INFO
creating dist
creating 'dist\oauth2-1.5.211-py2.7.egg' and adding 'build\bdist.win-amd64\egg' to it
removing 'build\bdist.win-amd64\egg' (and everything under it)
Processing oauth2-1.5.211-py2.7.egg
Copying oauth2-1.5.211-py2.7.egg to c:\python27\lib\site-packages
Adding oauth2 1.5.211 to easy-install.pth file

Installed c:\python27\lib\site-packages\oauth2-1.5.211-py2.7.egg
Processing dependencies for oauth2==1.5.211
Searching for httplib2
Reading http://pypi.python.org/simple/httplib2/
Reading http://code.google.com/p/httplib2/
Best match: httplib2 0.8
Downloading http://httplib2.googlecode.com/files/httplib2-0.8.zip
Processing httplib2-0.8.zip
Running httplib2-0.8\setup.py -q bdist_egg --dist-dir c:\users\gerard\appdata\local\temp\easy_install-4xhxlm\httplib2-0.8\egg-dist-tmp-rbo
a
zip_safe flag not set; analyzing archive contents...
httplib2.__init__: module references __file__
Adding httplib2 0.8 to easy-install.pth file

Installed c:\python27\lib\site-packages\httplib2-0.8-py2.7.egg
Finished processing dependencies for oauth2==1.5.211

Install will fire two steps:

  • the build
  • and the installation

1.1 - Build

python setup.py build

The build command is responsible for putting the files to install into a build directory.

By default, this is build under the distribution root. You can change the build directory with the –build-base option.

python setup.py build --build-base=/path/to/pybuild/foo-1.0
Advertising

1.2 - Install

python setup.py install

Install copies everything under build/lib (or build/lib.plat) to an installation directory.

The default value on windows is Python_Home\Lib\site-packages.

2 - Support

2.1 - ImportError: No module named setuptools

Traceback (most recent call last):
  File "setup.py", line 2, in <module>
    from setuptools import setup, find_packages
ImportError: No module named setuptools

Install the setup tools

2.2 - Windows 64 bit: python was not found in the registry

2.2.1 - First

reg copy HKLM\SOFTWARE\Python HKLM\SOFTWARE\Wow6432Node\Python /s

2.2.2 - Two

The library installation try to find the key registry under HKEY_CURRENT_USER. If the python installation was performed for All User, the key are present under HKEY_LOCAL_MACHINE.

To create the keys under HKEY_CURRENT_USER:

  • download the keys under HKEY_LOCAL_MACHINE.

  • open the exported file with a text editor and replace HKEY_LOCAL_MACHINE with HKEY_CURRENT_USER to obtain:
Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\SOFTWARE\Python]

[HKEY_CURRENT_USER\SOFTWARE\Python\PythonCore]

[HKEY_CURRENT_USER\SOFTWARE\Python\PythonCore\2.7]

[HKEY_CURRENT_USER\SOFTWARE\Python\PythonCore\2.7\Help]

[HKEY_CURRENT_USER\SOFTWARE\Python\PythonCore\2.7\Help\Main Python Documentation]
@="C:\\Python27\\Doc\\python274.chm"

[HKEY_CURRENT_USER\SOFTWARE\Python\PythonCore\2.7\InstallPath]
@="C:\\Python27\\"

[HKEY_CURRENT_USER\SOFTWARE\Python\PythonCore\2.7\InstallPath\InstallGroup]
@="Python 2.7"

[HKEY_CURRENT_USER\SOFTWARE\Python\PythonCore\2.7\Modules]

[HKEY_CURRENT_USER\SOFTWARE\Python\PythonCore\2.7\PythonPath]
@="C:\\Python27\\Lib;C:\\Python27\\DLLs;C:\\Python27\\Lib\\lib-tk"
  • Save the file and run it
regedt32 python_key.reg
Advertising

3 - Documentation / Reference

lang/python/grammar/module_install.txt · Last modified: 2018/11/21 21:46 by gerardnico