Install python packages in Compose on Windows platform
solidThinking Compose comes with built-in
Python environment that allows you to author, execute and debug python programs, and interchange data with Compose programs, which could be combined together to accomplish more complicated tasks.
Currently the version of built-in python is 3.4.0 of win64 arch. Pre-installed pacakges are listed as following:
- Numpy – 1.9.2
- Scipy – 0.15.1
- Reportlab – 3.1.44
- Colorama – 0.3.3
- Ecdsa – 0.13
- Matplotlib – 1.4.3
- Pillow – 2.7.0
- Pycrypto-2.6.1
- PyTest-2.7.0
- Requests – 2.9.1
Of course you can extend the list by installing more python pacakges in multiple ways
Multiple ways of installing Python packages
First of all you can use the
pip command to install packages from offical repository.
You can run either python.exe
1 |
[crayon-600798e48891e168583081 inline="true" ]<INSTALLATION_ROOT>\python\python3.4\<platform>\python.exe -m pip install <package> |
[/crayon]
or directly run pip.exe
1 |
[crayon-600798e488923960249364 inline="true" ]<INSTALLATION_ROOT>\python\python3.4\<platform>\Scripts\pip.exe install <package> |
[/crayon]
Alternatively, sometimes it’s wise to install a precompiled binary that downloaded from other sources, rather than install the the pacakge from online, which could require compling from source.
Resolving dependency issues is a tricky task on Windows.
- Download the wheel package from Python packages
- Use following commands to install the wheel pacakge
1 |
[crayon-600798e488928072391064 inline="true" ]<INSTALLATION_ROOT>\python\python3.4\<platform>\Scripts\pip.exeinstall <path-to-wheel>/package_name.whl |
[/crayon]
Note: It is important to pay attention to the package name when downloading the packages from Python packages
Since the python environment version is 3.4.0 and system architecture is win64, you’ll need to get the package with the name like pandas-0.20.3-cp34-cp34m-win_amd64.whl for example.
How to uninstall a Python package
You’ll probably need administrator privilege to run this command
1 |
[crayon-600798e48892e311168078 inline="true" ]<INSTALLATION_ROOT>\python\python3.4\<platform>\python.exe -m pip uninstall <package> |
[/crayon]
Resolving compiling errors for missing MSVC compiler
In case of compiling the pacakge from souce codes (when you really would do so), an error like following could happen.
building ‘lxml.etree’ extension
error: Microsoft Visual C++ 10.0 is required (Unable to find vcvarsall.bat).
It is due to the python packages presumes Visual Studio 2010 shall be used on the Windows machine. If you have other versions of Visual Studio installed, you can bypass the error by redefining the environmental variable VS100COMNTOOLS
1 |
[crayon-600798e488935383970134 inline="true" ]set VS100COMNTOOLS=%VS120COMNTOOLS% |
[/crayon]
本文出自扉启博客,转载时请注明出处及相应链接。
本文永久链接: https://www.feiqy.com/install-python-packages-in-compose-on-windows-platform/
近期评论