Содержание
- Windows may require your approval to install python
- Плагин matplotlib Python при переустановке Windows 10 не работает. Почему?
- Установка Python на Windows
- Рассмотрим установку языка программирования на Windows Server 2012, хотя установка на Windows 7, Windows 10 будет типовой.
- How to install Python on Windows | Opensource.com
- Install Python, run an IDE, and start coding right from your Microsoft Windows desktop.
- Subscribe now
- Get Python
- win-python-install.jpg
- Install Python
- win-python-path.jpg
- win-python-publisher.jpg
- Install an IDE
- IDLE 3
- idle3.png
- PyCharm IDE
- Tell Python what to do
- How do I install Python packages on Windows?
- 12 Answers 12
- 3. Using Python on Windows¶
- 3.1. Installing Python¶
- 3.1.1. Supported Versions¶
- 3.1.2. Installation Steps¶
- 3.1.3. Removing the MAX_PATH Limitation¶
- 3.1.4. Installing Without UI¶
- 3.1.5. Installing Without Downloading¶
- 3.1.6. Modifying an install¶
- 3.1.7. Other Platforms¶
- 3.2. Alternative bundles¶
- 3.3. Configuring Python¶
- 3.3.1. Excursus: Setting environment variables¶
- 3.3.2. Finding the Python executable¶
- 3.4. Python Launcher for Windows¶
- 3.4.1. Getting started¶
- 3.4.1.1. From the command-line¶
- 3.4.1.2. Virtual environments¶
- 3.4.1.3. From a script¶
- 3.4.1.4. From file associations¶
- 3.4.2. Shebang Lines¶
- 3.4.3. Arguments in shebang lines¶
- 3.4.4. Customization¶
- 3.4.4.1. Customization via INI files¶
- 3.4.4.2. Customizing default Python versions¶
- 3.4.5. Diagnostics¶
- 3.5. Finding modules¶
- 3.6. Additional modules¶
- 3.6.1. PyWin32¶
- 3.6.2. cx_Freeze¶
- 3.6.3. WConio¶
- 3.7. Compiling Python on Windows¶
- 3.8. Embedded Distribution¶
- 3.8.1. Python Application¶
- 3.8.2. Embedding Python¶
Плагин matplotlib Python при переустановке Windows 10 не работает. Почему?
В инфернете пишут, что может мешать библиотека freetype.dll от другого приложения (например, от java).
Рекомендуют попробовать так поменять системный path, чтобы папка python, anaconda и других пайтоновских приложений были раньше папки java. Тогда, якобы, оно будет правильную библиотеку находить раньше.
Сам не проверял, дома винды нету вааще.
На Windows 10 нужно понизить версию:
И да, matplotlib это не плагин, а библиотека.
BUILDING MATPLOTLIB
matplotlib: yes [3.0.3]
python: yes [3.8.6 (tags/v3.8.6:db45529, Sep 23 2020,
15:52:53) [MSC v.1927 64 bit (AMD64)]]
platform: yes [win32]
REQUIRED DEPENDENCIES AND EXTENSIONS
numpy: yes [version 1.19.2]
install_requires: yes [handled by setuptools]
libagg: yes [pkg-config information for ‘libagg’ could not
be found. Using local copy.]
freetype: no [The C/C++ header for freetype
(freetype2ft2build.h) could not be found. You may
need to install the development package.]
png: no [The C/C++ header for png (png.h) could not be
found. You may need to install the development
package.]
qhull: yes [pkg-config information for ‘libqhull’ could not
be found. Using local copy.]
OPTIONAL SUBPACKAGES
sample_data: yes [installing]
toolkits: yes [installing]
tests: no [skipping due to configuration]
toolkits_tests: no [skipping due to configuration]
OPTIONAL BACKEND EXTENSIONS
agg: yes [installing]
tkagg: yes [installing; run-time loading from Python Tcl /
Tk]
macosx: no [Mac OS-X only]
windowing: yes [installing]
OPTIONAL PACKAGE DATA
dlls: no [skipping due to configuration]
============================================================================
* The following required packages can not be built:
* freetype, png
* Please check gnuwin32.sourceforge.net/packa
* ges/freetype.htm for instructions to install
* freetype
* Please check gnuwin32.sourceforge.net/packa
* ges/libpng.htm for instructions to install png
—————————————-
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
3 разных компьютера и одна ошибка. Образ Windows 10 брался с официального сайта. Уже установлен MS C++ 2015. Что именно не так с компьютерами или что не так я делаю?
Установка Python на Windows
Рассмотрим установку языка программирования на Windows Server 2012, хотя установка на Windows 7, Windows 10 будет типовой.
Итак, для установки нам потребуется дистрибутив Python версию которой выбираем и скачиваем по ссылке: https://www.python.org/downloads/
Скачать Python для windows
Выбираем установку для всех пользователей:
Выбираем установку для всех пользователей
Выбираем директорию для установки, я оставляю по умолчанию C:Python27:
Выбираем директорию для установки
Далее по умолчанию нажимаем NEXT, NEXT до окончания установки:
Теперь необходимо проверить добавился ли путь для командной строки.
В диспетчере задач нажимаем Run new task:
Запускаем новую задачу Run new task
Набираем cmd и жмем ENTER:
Запускаем окно терминала
В окне терминала набираем python и жмем Enter, если выдаст информацию, то на этом инсталляция закончена.
У меня, как всегда, просто не получается и python выдает ошибку:
В этом же окне терминала набираем sysdm.cpl и попадаем в System Properties:
Набираем sysdm.cpl — Enter
Теперь нужно зайти в закладку Advanced и нажать кнопку Environment Variables:
Редактируем Path, добавляем в конце через точку с запятой путь куда установили Python, у меня это выглядит так — ;C:Python27:
Открываем Path Дописываем пути ;C:Python27
Теперь пробуем прописать python, но сделать это нужно в новом окне терминала, который подтянет наши записи:
Python 2.7.14 установлен
Вот теперь установка Python закончена и можно работать.
How to install Python on Windows | Opensource.com
Install Python, run an IDE, and start coding right from your Microsoft Windows desktop.
Subscribe now
Get the highlights in your inbox every week.
So you want to learn to program? One of the most common languages to start with is Python, popular for its unique blend of object-oriented structure and simple syntax. Python is also an interpreted language, meaning you don’t need to learn how to compile code into machine language: Python does that for you, allowing you to test your programs sometimes instantly and, in a way, while you write your code.
Just because Python is easy to learn doesn’t mean you should underestimate its potential power. Python is used by movie studios, financial institutions, IT houses, video game studios, makers, hobbyists, artists, teachers, and many others.
On the other hand, Python is also a serious programming language, and learning it takes dedication and practice. Then again, you don’t have to commit to anything just yet. You can install and try Python on nearly any computing platform, so if you’re on Windows, this article is for you.
If you want to try Python on a completely open source operating system, you can install Linux and then try Python.
Get Python
Python is available from its website, Python.org. Once there, hover your mouse over the Downloads menu, then over the Windows option, and then click the button to download the latest release.
win-python-install.jpg
Alternatively, you can click the Downloads menu button and select a specific version from the downloads page.
Install Python
Once the package is downloaded, open it to start the installer.
It is safe to accept the default install location, and it’s vital to add Python to PATH. If you don’t add Python to your PATH, then Python applications won’t know where to find Python (which they require in order to run). This is not selected by default, so activate it at the bottom of the install window before continuing!
win-python-path.jpg
Before Windows allows you to install an application from a publisher other than Microsoft, you must give your approval. Click the Yes button when prompted by the User Account Control system.
win-python-publisher.jpg
Wait patiently for Windows to distribute the files from the Python package into the appropriate locations, and when it’s finished, you’re done installing Python.
Install an IDE
To write programs in Python, all you really need is a text editor, but it’s convenient to have an integrated development environment (IDE). An IDE integrates a text editor with some friendly and helpful Python features. IDLE 3 and Pycharm (Community Edition) are two great open source options to consider.
IDLE 3
Python comes with an IDE called IDLE. You can write code in any text editor, but using an IDE provides you with keyword highlighting to help detect typos, a Run button to test code quickly and easily, and other code-specific features that a plain text editor like Notepad++ normally doesn’t have.
To start IDLE, click the Start (or Window) menu and type python for matches. You may find a few matches, since Python provides more than one interface, so make sure you launch IDLE.
idle3.png
If you don’t see Python in the Start menu, reinstall Python. Be sure to select Add Python to PATH in the install wizard. Refer to the Python docs for detailed instructions.
PyCharm IDE
If you already have some coding experience and IDLE seems too simple for you, try PyCharm (Community Edition), an open source IDE for Python. It has keyword highlighting to help detect typos, quotation and parenthesis completion to avoid syntax errors, line numbers (helpful when debugging), indentation markers, and a Run button to test code quickly and easily.
To install it, visit the PyCharm IDE website, download the installer, and run it. The process is the same as with Python: start the installer, allow Windows to install a non-Microsoft application, and wait for the installer to finish.
Once PyCharm is installed, double-click the PyCharm icon on your desktop or select it from the Start menu.
Tell Python what to do
Keywords tell Python what you want it to do. In IDLE, go to the File menu and create a new file. In PyCharm, click the New Project button.
In your new, empty file, type this into IDLE or PyCharm:
How do I install Python packages on Windows?
I’m having a hard time setting up python packages. EasyInstall from SetupTools is supposed to help that, but they don’t have an executable for Python 2.6.
For instance to install Mechanize, I’m just supposed to put the Mechanize folder in C:Python24Libsite-packages according to INSTALL.txt, but runnning the tests does not work. Can someone help shed some light on this? Thanks!
12 Answers 12
Newer versions of Python for Windows come with the pip package manager. (source)
pip is already installed if you’re using Python 2 >=2.7.9 or Python 3 >=3.4
Use that to install packages:
So in your case it’d be:
This is a good tutorial on how to get easy_install on windows. The short answer: add C:Python26Scripts (or whatever python you have installed) to your PATH.
You don’t need the executable for setuptools. You can download the source code, unpack it, traverse to the downloaded directory and run python setup.py install in the command prompt
Starting with Python 2.7, pip is included by default. Simply download your desired package via
Packaging in Python is dire. The root cause is that the language ships without a package manager.
Fortunately, there is one package manager for Python, called Pip. Pip is inspired by Ruby’s Gem, but lacks some features. Ironically, Pip itself is complicated to install. Installation on the popular 64-bit Windows demands building and installing two packages from source. This is a big ask for anyone new to programming.
So the right thing to do is to install pip. However if you can’t be bothered, Christoph Gohlke provides binaries for popular Python packages for all Windows platforms http://www.lfd.uci.edu/
In fact, building some Python packages requires a C compiler (eg. mingw32) and library headers for the dependencies. This can be a nightmare on Windows, so remember the name Christoph Gohlke.
I had problems in installing packages on Windows. Found the solution. It works in Windows7+. Mainly anything with Windows Powershell should be able to make it work. This can help you get started with it.
That worked for me when nothing else was making any sense. I use Python 2.7 but the documentation suggests that same would work for Python 3.x also.
3. Using Python on Windows¶
This document aims to give an overview of Windows-specific behaviour you should know about when using Python on Microsoft Windows.
3.1. Installing Python¶
Unlike most Unix systems and services, Windows does not include a system supported installation of Python. To make Python available, the CPython team has compiled Windows installers (MSI packages) with every release for many years. These installers are primarily intended to add a per-user installation of Python, with the core interpreter and library being used by a single user. The installer is also able to install for all users of a single machine, and a separate ZIP file is available for application-local distributions.
3.1.1. Supported Versions¶
As specified in PEP 11, a Python release only supports a Windows platform while Microsoft considers the platform under extended support. This means that Python 3.7 supports Windows Vista and newer. If you require Windows XP support then please install Python 3.4.
3.1.2. Installation Steps¶
After starting the installer, one of two options may be selected:
If you select “Install Now”:
Selecting “Customize installation” will allow you to select the features to install, the installation location and other options or post-install actions. To install debugging symbols or binaries, you will need to use this option.
To perform an all-users installation, you should select “Customize installation”. In this case:
3.1.3. Removing the MAX_PATH Limitation¶
Windows historically has limited path lengths to 260 characters. This meant that paths longer than this would not resolve and errors would result.
This allows the open() function, the os module and most other path functionality to accept and return paths longer than 260 characters when using strings. (Use of bytes as paths is deprecated on Windows, and this feature is not available when using bytes.)
After changing the above option, no further configuration is required.
Changed in version 3.6: Support for long paths was enabled in Python.
3.1.4. Installing Without UI¶
All of the options available in the installer UI can also be specified from the command line, allowing scripted installers to replicate an installation on many machines without user interaction. These options may also be set without suppressing the UI in order to change some of the defaults.
For example, to silently install a default, system-wide Python installation, you could use the following command (from an elevated command prompt):
To allow users to easily install a personal copy of Python without the test suite, you could provide a shortcut with the following command. This will display a simplified initial page and disallow customization:
(Note that omitting the launcher also omits file associations, and is only recommended for per-user installs when there is also a system-wide installation that included the launcher.)
The options listed above can also be provided in a file named unattend.xml alongside the executable. This file specifies a list of options and values. When a value is provided as an attribute, it will be converted to a number if possible. Values provided as element text are always left as strings. This example file sets the same options and the previous example:
3.1.5. Installing Without Downloading¶
As some features of Python are not included in the initial installer download, selecting those features may require an internet connection. To avoid this need, all possible components may be downloaded on-demand to create a complete layout that will no longer require an internet connection regardless of the selected features. Note that this download may be bigger than required, but where a large number of installations are going to be performed it is very useful to have a locally cached copy.
Execute the following command from Command Prompt to download all possible required files. Remember to substitute python-3.6.0.exe for the actual name of your installer, and to create layouts in their own directories to avoid collisions between files with the same name.
You may also specify the /quiet option to hide the progress display.
3.1.6. Modifying an install¶
Once Python has been installed, you can add or remove features through the Programs and Features tool that is part of Windows. Select the Python entry and choose “Uninstall/Change” to open the installer in maintenance mode.
“Repair” will verify all the files that should be installed using the current settings and replace any that have been removed or modified.
3.1.7. Other Platforms¶
With ongoing development of Python, some platforms that used to be supported earlier are no longer supported (due to the lack of users or developers). Check PEP 11 for details on all unsupported platforms.
See Python for Windows for detailed information about platforms with pre-compiled installers.
Python on XP “7 Minutes to “Hello World!”” by Richard Dooling, 2006 Installing on Windows in “Dive into Python: Python from novice to pro” by Mark Pilgrim, 2004, ISBN 1-59059-356-1 For Windows users in “Installing Python” in “A Byte of Python” by Swaroop C H, 2003
3.2. Alternative bundles¶
Besides the standard CPython distribution, there are modified packages including additional functionality. The following is a list of popular versions and their key features:
ActivePython Installer with multi-platform compatibility, documentation, PyWin32 Anaconda Popular scientific modules (such as numpy, scipy and pandas) and the conda package manager. Canopy A “comprehensive Python analysis environment” with editors and other development tools. WinPython Windows-specific distribution with prebuilt scientific packages and tools for building packages.
Note that these packages may not include the latest versions of Python or other libraries, and are not maintained or supported by the core Python team.
3.3. Configuring Python¶
3.3.1. Excursus: Setting environment variables¶
Windows allows environment variables to be configured permanently at both the User level and the System level, or temporarily in a command prompt.
To temporarily set environment variables, open Command Prompt and use the set command:
These changes will apply to any further commands executed in that console, and will be inherited by any applications started from the console.
Including the variable name within percent signs will expand to the existing value, allowing you to add your new value at either the start or the end. Modifying PATH by adding the directory containing python.exe to the start is a common way to ensure the correct version of Python is launched.
To permanently modify the default environment variables, click Start and search for ‘edit environment variables’, or open System properties, Advanced system settings and click the Environment Variables button. In this dialog, you can add or modify User and System variables. To change System variables, you need non-restricted access to your machine (i.e. Administrator rights).
The PYTHONPATH variable is used by all versions of Python 2 and Python 3, so you should not permanently configure this variable unless it only includes code that is compatible with all of your installed Python versions.
https://support.microsoft.com/kb/100843 Environment variables in Windows NT https://technet.microsoft.com/en-us/library/cc754250.aspx The SET command, for temporarily modifying environment variables https://technet.microsoft.com/en-us/library/cc755104.aspx The SETX command, for permanently modifying environment variables https://support.microsoft.com/kb/310519 How To Manage Environment Variables in Windows XP https://www.chem.gla.ac.uk/
louis/software/faq/q1.html Setting Environment variables, Louis J. Farrugia
3.3.2. Finding the Python executable¶
Changed in version 3.5.
Besides using the automatically created start menu entry for the Python interpreter, you might want to start Python in the command prompt. The installer has an option to set that up for you.
3.4. Python Launcher for Windows¶
The Python launcher for Windows is a utility which aids in locating and executing of different Python versions. It allows scripts (or the command-line) to indicate a preference for a specific Python version, and will locate and execute that version.
Unlike the PATH variable, the launcher will correctly select the most appropriate version of Python. It will prefer per-user installations over system-wide ones, and orders by language version rather than using the most recently installed version.
3.4.1. Getting started¶
3.4.1.1. From the command-line¶
Changed in version 3.6.
If you want the latest version of Python 2.x you have installed, try the command:
You should find the latest version of Python 2.x starts.
If you see the following error, you do not have the launcher installed:
Per-user installations of Python do not add the launcher to PATH unless the option was selected on installation.
3.4.1.2. Virtual environments¶
If the launcher is run with no explicit Python version specification, and a virtual environment (created with the standard library venv module or the external virtualenv tool) active, the launcher will run the virtual environment’s interpreter rather than the global one. To run the global interpreter, either deactivate the virtual environment, or explicitly specify the global Python version.
3.4.1.3. From a script¶
From the directory in which hello.py lives, execute the command:
You should notice the version number of your latest Python 2.x installation is printed. Now try changing the first line to be:
Re-executing the command should now print the latest Python 3.x information. As with the above command-line examples, you can specify a more explicit version qualifier. Assuming you have Python 2.6 installed, try changing the first line to #! python2.6 and you should find the 2.6 version information printed.
Note that unlike interactive use, a bare “python” will use the latest version of Python 2.x that you have installed. This is for backward compatibility and for compatibility with Unix, where the command python typically refers to Python 2.
3.4.1.4. From file associations¶
The key benefit of this is that a single launcher can support multiple Python versions at the same time depending on the contents of the first line.
3.4.2. Shebang Lines¶
To allow shebang lines in Python scripts to be portable between Unix and Windows, this launcher supports a number of ‘virtual’ commands to specify which interpreter to use. The supported virtual commands are:
For example, if the first line of your script starts with
The /usr/bin/env form of shebang line has one further special property. Before looking for installed Python interpreters, this form will search the executable PATH for a Python executable. This corresponds to the behaviour of the Unix env program, which performs a PATH search.
3.4.3. Arguments in shebang lines¶
The shebang lines can also specify additional options to be passed to the Python interpreter. For example, if you have a shebang line:
3.4.4. Customization¶
3.4.4.1. Customization via INI files¶
3.4.4.2. Customizing default Python versions¶
In some cases, a version qualifier can be included in a command to dictate which version of Python will be used by the command. A version qualifier starts with a major version number and can optionally be followed by a period (‘.’) and a minor version specifier. If the minor qualifier is specified, it may optionally be followed by “-32” to indicate the 32-bit implementation of that version be used.
For example, a shebang line of #!python has no version qualifier, while #!python3 has a version qualifier which specifies only a major version.
If no minor version qualifiers are found, the environment variable PY_PYTHON (where is the current major version qualifier as determined above) can be set to specify the full version. If no such option is found, the launcher will enumerate the installed Python versions and use the latest minor release found for the major version, which is likely, although not guaranteed, to be the most recently installed version in that family.
3.4.5. Diagnostics¶
If an environment variable PYLAUNCH_DEBUG is set (to any value), the launcher will print diagnostic information to stderr (i.e. to the console). While this information manages to be simultaneously verbose and terse, it should allow you to see what versions of Python were located, why a particular version was chosen and the exact command-line used to execute the target Python.
3.5. Finding modules¶
If a pyvenv.cfg file is found alongside the main executable or in the directory one level above the executable, the following variations apply:
The end result of all this is:
For those who want to bundle Python into their application or distribution, the following advice will prevent conflicts with other installations:
These will ensure that the files in a system-wide installation will not take precedence over the copy of the standard library bundled with your application. Otherwise, your users may experience problems using your application. Note that the first suggestion is the best, as the other may still be susceptible to non-standard paths in the registry and user site-packages.
3.6. Additional modules¶
Even though Python aims to be portable among all platforms, there are features that are unique to Windows. A couple of modules, both in the standard library and external, and snippets exist to use these features.
3.6.1. PyWin32¶
The PyWin32 module by Mark Hammond is a collection of modules for advanced Windows-specific support. This includes utilities for:
PythonWin is a sample MFC application shipped with PyWin32. It is an embeddable IDE with a built-in debugger.
Win32 How Do I. by Tim Golden Python and COM by David and Paul Boddie
3.6.2. cx_Freeze¶
3.6.3. WConio¶
3.7. Compiling Python on Windows¶
If you want to compile CPython yourself, first thing you should do is get the source. You can download either the latest release’s source or just grab a fresh checkout.
The source tree contains a build solution and project files for Microsoft Visual Studio 2015, which is the compiler used to build the official Python releases. These files are in the PCbuild directory.
Check PCbuild/readme.txt for general information on the build process.
Python + Windows + distutils + SWIG + gcc MinGW or “Creating Python extensions in C/C++ with SWIG and compiling them with MinGW gcc under Windows” or “Installing Python extension with distutils and without Microsoft Visual C++” by Sébastien Sauvage, 2003 MingW – Python extensions by Trent Apted et al, 2007
3.8. Embedded Distribution¶
The embedded distribution is a ZIP file containing a minimal Python environment. It is intended for acting as part of another application, rather than being directly accessed by end-users.
The embedded distribution does not include the Microsoft C Runtime and it is the responsibility of the application installer to provide this. The runtime may have already been installed on a user’s system previously or automatically via Windows Update, and can be detected by finding ucrtbase.dll in the system directory.
Third-party packages should be installed by the application installer alongside the embedded distribution. Using pip to manage dependencies as for a regular Python installation is not supported with this distribution, though with some care it may be possible to include and use pip for automatic updates. In general, third-party packages should be treated as part of the application (“vendoring”) so that the developer can ensure compatibility with newer versions before providing updates to users.
The two recommended use cases for this distribution are described below.
3.8.1. Python Application¶
An application written in Python does not necessarily require users to be aware of that fact. The embedded distribution may be used in this case to include a private version of Python in an install package. Depending on how transparent it should be (or conversely, how professional it should appear), there are two options.
Using a specialized executable as a launcher requires some coding, but provides the most transparent experience for users. With a customized launcher, there are no obvious indications that the program is running on Python: icons can be customized, company and version information can be specified, and file associations behave properly. In most cases, a custom launcher should simply be able to call Py_Main with a hard-coded command line.
The simpler approach is to provide a batch file or generated shortcut that directly calls the python.exe or pythonw.exe with the required command-line arguments. In this case, the application will appear to be Python and not its actual name, and users may have trouble distinguishing it from other running Python processes or file associations.
With the latter approach, packages should be installed as directories alongside the Python executable to ensure they are available on the path. With the specialized launcher, packages can be located in other locations as there is an opportunity to specify the search path before launching the application.
3.8.2. Embedding Python¶
As with the application use, packages can be installed to any location as there is an opportunity to specify search paths before initializing the interpreter. Otherwise, there is no fundamental differences between using the embedded distribution and a regular installation.
Источник
Содержание
- Windows may require your approval to install python
- Плагин matplotlib Python при переустановке Windows 10 не работает. Почему?
- Установка Python на Windows
- Рассмотрим установку языка программирования на Windows Server 2012, хотя установка на Windows 7, Windows 10 будет типовой.
- How to install Python on Windows | Opensource.com
- Install Python, run an IDE, and start coding right from your Microsoft Windows desktop.
- Subscribe now
- Get Python
- win-python-install.jpg
- Install Python
- win-python-path.jpg
- win-python-publisher.jpg
- Install an IDE
- IDLE 3
- idle3.png
- PyCharm IDE
- Tell Python what to do
- How do I install Python packages on Windows?
- 12 Answers 12
- 3. Using Python on Windows¶
- 3.1. Installing Python¶
- 3.1.1. Supported Versions¶
- 3.1.2. Installation Steps¶
- 3.1.3. Removing the MAX_PATH Limitation¶
- 3.1.4. Installing Without UI¶
- 3.1.5. Installing Without Downloading¶
- 3.1.6. Modifying an install¶
- 3.1.7. Other Platforms¶
- 3.2. Alternative bundles¶
- 3.3. Configuring Python¶
- 3.3.1. Excursus: Setting environment variables¶
- 3.3.2. Finding the Python executable¶
- 3.4. Python Launcher for Windows¶
- 3.4.1. Getting started¶
- 3.4.1.1. From the command-line¶
- 3.4.1.2. Virtual environments¶
- 3.4.1.3. From a script¶
- 3.4.1.4. From file associations¶
- 3.4.2. Shebang Lines¶
- 3.4.3. Arguments in shebang lines¶
- 3.4.4. Customization¶
- 3.4.4.1. Customization via INI files¶
- 3.4.4.2. Customizing default Python versions¶
- 3.4.5. Diagnostics¶
- 3.5. Finding modules¶
- 3.6. Additional modules¶
- 3.6.1. PyWin32¶
- 3.6.2. cx_Freeze¶
- 3.6.3. WConio¶
- 3.7. Compiling Python on Windows¶
- 3.8. Embedded Distribution¶
- 3.8.1. Python Application¶
- 3.8.2. Embedding Python¶
Windows may require your approval to install python
Плагин matplotlib Python при переустановке Windows 10 не работает. Почему?
В инфернете пишут, что может мешать библиотека freetype.dll от другого приложения (например, от java).
Рекомендуют попробовать так поменять системный path, чтобы папка python, anaconda и других пайтоновских приложений были раньше папки java. Тогда, якобы, оно будет правильную библиотеку находить раньше.
Сам не проверял, дома винды нету вааще.
На Windows 10 нужно понизить версию:
И да, matplotlib это не плагин, а библиотека.
BUILDING MATPLOTLIB
matplotlib: yes [3.0.3]
python: yes [3.8.6 (tags/v3.8.6:db45529, Sep 23 2020,
15:52:53) [MSC v.1927 64 bit (AMD64)]]
platform: yes [win32]
REQUIRED DEPENDENCIES AND EXTENSIONS
numpy: yes [version 1.19.2]
install_requires: yes [handled by setuptools]
libagg: yes [pkg-config information for ‘libagg’ could not
be found. Using local copy.]
freetype: no [The C/C++ header for freetype
(freetype2\ft2build.h) could not be found. You may
need to install the development package.]
png: no [The C/C++ header for png (png.h) could not be
found. You may need to install the development
package.]
qhull: yes [pkg-config information for ‘libqhull’ could not
be found. Using local copy.]
OPTIONAL SUBPACKAGES
sample_data: yes [installing]
toolkits: yes [installing]
tests: no [skipping due to configuration]
toolkits_tests: no [skipping due to configuration]
OPTIONAL BACKEND EXTENSIONS
agg: yes [installing]
tkagg: yes [installing; run-time loading from Python Tcl /
Tk]
macosx: no [Mac OS-X only]
windowing: yes [installing]
OPTIONAL PACKAGE DATA
dlls: no [skipping due to configuration]
============================================================================
* The following required packages can not be built:
* freetype, png
* Please check gnuwin32.sourceforge.net/packa
* ges/freetype.htm for instructions to install
* freetype
* Please check gnuwin32.sourceforge.net/packa
* ges/libpng.htm for instructions to install png
—————————————-
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
3 разных компьютера и одна ошибка. Образ Windows 10 брался с официального сайта. Уже установлен MS C++ 2015. Что именно не так с компьютерами или что не так я делаю?
Установка Python на Windows
Рассмотрим установку языка программирования на Windows Server 2012, хотя установка на Windows 7, Windows 10 будет типовой.
Итак, для установки нам потребуется дистрибутив Python версию которой выбираем и скачиваем по ссылке: https://www.python.org/downloads/
Скачать Python для windows
Выбираем установку для всех пользователей:
Выбираем установку для всех пользователей
Выбираем директорию для установки, я оставляю по умолчанию C:\Python27:
Выбираем директорию для установки
Далее по умолчанию нажимаем NEXT, NEXT до окончания установки:
Теперь необходимо проверить добавился ли путь для командной строки.
В диспетчере задач нажимаем Run new task:
Запускаем новую задачу Run new task
Набираем cmd и жмем ENTER:
Запускаем окно терминала
В окне терминала набираем python и жмем Enter, если выдаст информацию, то на этом инсталляция закончена.
У меня, как всегда, просто не получается и python выдает ошибку:
В этом же окне терминала набираем sysdm.cpl и попадаем в System Properties:
Набираем sysdm.cpl — Enter
Теперь нужно зайти в закладку Advanced и нажать кнопку Environment Variables:
Редактируем Path, добавляем в конце через точку с запятой путь куда установили Python, у меня это выглядит так — ;C:\Python27:
Открываем Path Дописываем пути ;C:\Python27
Теперь пробуем прописать python, но сделать это нужно в новом окне терминала, который подтянет наши записи:
Python 2.7.14 установлен
Вот теперь установка Python закончена и можно работать.
How to install Python on Windows | Opensource.com
Install Python, run an IDE, and start coding right from your Microsoft Windows desktop.
Subscribe now
Get the highlights in your inbox every week.
So you want to learn to program? One of the most common languages to start with is Python, popular for its unique blend of object-oriented structure and simple syntax. Python is also an interpreted language, meaning you don’t need to learn how to compile code into machine language: Python does that for you, allowing you to test your programs sometimes instantly and, in a way, while you write your code.
Just because Python is easy to learn doesn’t mean you should underestimate its potential power. Python is used by movie studios, financial institutions, IT houses, video game studios, makers, hobbyists, artists, teachers, and many others.
On the other hand, Python is also a serious programming language, and learning it takes dedication and practice. Then again, you don’t have to commit to anything just yet. You can install and try Python on nearly any computing platform, so if you’re on Windows, this article is for you.
If you want to try Python on a completely open source operating system, you can install Linux and then try Python.
Get Python
Python is available from its website, Python.org. Once there, hover your mouse over the Downloads menu, then over the Windows option, and then click the button to download the latest release.
win-python-install.jpg
Alternatively, you can click the Downloads menu button and select a specific version from the downloads page.
Install Python
Once the package is downloaded, open it to start the installer.
It is safe to accept the default install location, and it’s vital to add Python to PATH. If you don’t add Python to your PATH, then Python applications won’t know where to find Python (which they require in order to run). This is not selected by default, so activate it at the bottom of the install window before continuing!
win-python-path.jpg
Before Windows allows you to install an application from a publisher other than Microsoft, you must give your approval. Click the Yes button when prompted by the User Account Control system.
win-python-publisher.jpg
Wait patiently for Windows to distribute the files from the Python package into the appropriate locations, and when it’s finished, you’re done installing Python.
Install an IDE
To write programs in Python, all you really need is a text editor, but it’s convenient to have an integrated development environment (IDE). An IDE integrates a text editor with some friendly and helpful Python features. IDLE 3 and Pycharm (Community Edition) are two great open source options to consider.
IDLE 3
Python comes with an IDE called IDLE. You can write code in any text editor, but using an IDE provides you with keyword highlighting to help detect typos, a Run button to test code quickly and easily, and other code-specific features that a plain text editor like Notepad++ normally doesn’t have.
To start IDLE, click the Start (or Window) menu and type python for matches. You may find a few matches, since Python provides more than one interface, so make sure you launch IDLE.
idle3.png
If you don’t see Python in the Start menu, reinstall Python. Be sure to select Add Python to PATH in the install wizard. Refer to the Python docs for detailed instructions.
PyCharm IDE
If you already have some coding experience and IDLE seems too simple for you, try PyCharm (Community Edition), an open source IDE for Python. It has keyword highlighting to help detect typos, quotation and parenthesis completion to avoid syntax errors, line numbers (helpful when debugging), indentation markers, and a Run button to test code quickly and easily.
To install it, visit the PyCharm IDE website, download the installer, and run it. The process is the same as with Python: start the installer, allow Windows to install a non-Microsoft application, and wait for the installer to finish.
Once PyCharm is installed, double-click the PyCharm icon on your desktop or select it from the Start menu.
Tell Python what to do
Keywords tell Python what you want it to do. In IDLE, go to the File menu and create a new file. In PyCharm, click the New Project button.
In your new, empty file, type this into IDLE or PyCharm:
How do I install Python packages on Windows?
I’m having a hard time setting up python packages. EasyInstall from SetupTools is supposed to help that, but they don’t have an executable for Python 2.6.
For instance to install Mechanize, I’m just supposed to put the Mechanize folder in C:\Python24\Lib\site-packages according to INSTALL.txt, but runnning the tests does not work. Can someone help shed some light on this? Thanks!
12 Answers 12
Newer versions of Python for Windows come with the pip package manager. (source)
pip is already installed if you’re using Python 2 >=2.7.9 or Python 3 >=3.4
Use that to install packages:
So in your case it’d be:
This is a good tutorial on how to get easy_install on windows. The short answer: add C:\Python26\Scripts (or whatever python you have installed) to your PATH.
You don’t need the executable for setuptools. You can download the source code, unpack it, traverse to the downloaded directory and run python setup.py install in the command prompt
Starting with Python 2.7, pip is included by default. Simply download your desired package via
Packaging in Python is dire. The root cause is that the language ships without a package manager.
Fortunately, there is one package manager for Python, called Pip. Pip is inspired by Ruby’s Gem, but lacks some features. Ironically, Pip itself is complicated to install. Installation on the popular 64-bit Windows demands building and installing two packages from source. This is a big ask for anyone new to programming.
So the right thing to do is to install pip. However if you can’t be bothered, Christoph Gohlke provides binaries for popular Python packages for all Windows platforms http://www.lfd.uci.edu/
In fact, building some Python packages requires a C compiler (eg. mingw32) and library headers for the dependencies. This can be a nightmare on Windows, so remember the name Christoph Gohlke.
I had problems in installing packages on Windows. Found the solution. It works in Windows7+. Mainly anything with Windows Powershell should be able to make it work. This can help you get started with it.
That worked for me when nothing else was making any sense. I use Python 2.7 but the documentation suggests that same would work for Python 3.x also.
3. Using Python on Windows¶
This document aims to give an overview of Windows-specific behaviour you should know about when using Python on Microsoft Windows.
3.1. Installing Python¶
Unlike most Unix systems and services, Windows does not include a system supported installation of Python. To make Python available, the CPython team has compiled Windows installers (MSI packages) with every release for many years. These installers are primarily intended to add a per-user installation of Python, with the core interpreter and library being used by a single user. The installer is also able to install for all users of a single machine, and a separate ZIP file is available for application-local distributions.
3.1.1. Supported Versions¶
As specified in PEP 11, a Python release only supports a Windows platform while Microsoft considers the platform under extended support. This means that Python 3.7 supports Windows Vista and newer. If you require Windows XP support then please install Python 3.4.
3.1.2. Installation Steps¶
After starting the installer, one of two options may be selected:
If you select “Install Now”:
Selecting “Customize installation” will allow you to select the features to install, the installation location and other options or post-install actions. To install debugging symbols or binaries, you will need to use this option.
To perform an all-users installation, you should select “Customize installation”. In this case:
3.1.3. Removing the MAX_PATH Limitation¶
Windows historically has limited path lengths to 260 characters. This meant that paths longer than this would not resolve and errors would result.
This allows the open() function, the os module and most other path functionality to accept and return paths longer than 260 characters when using strings. (Use of bytes as paths is deprecated on Windows, and this feature is not available when using bytes.)
After changing the above option, no further configuration is required.
Changed in version 3.6: Support for long paths was enabled in Python.
3.1.4. Installing Without UI¶
All of the options available in the installer UI can also be specified from the command line, allowing scripted installers to replicate an installation on many machines without user interaction. These options may also be set without suppressing the UI in order to change some of the defaults.
For example, to silently install a default, system-wide Python installation, you could use the following command (from an elevated command prompt):
To allow users to easily install a personal copy of Python without the test suite, you could provide a shortcut with the following command. This will display a simplified initial page and disallow customization:
(Note that omitting the launcher also omits file associations, and is only recommended for per-user installs when there is also a system-wide installation that included the launcher.)
The options listed above can also be provided in a file named unattend.xml alongside the executable. This file specifies a list of options and values. When a value is provided as an attribute, it will be converted to a number if possible. Values provided as element text are always left as strings. This example file sets the same options and the previous example:
3.1.5. Installing Without Downloading¶
As some features of Python are not included in the initial installer download, selecting those features may require an internet connection. To avoid this need, all possible components may be downloaded on-demand to create a complete layout that will no longer require an internet connection regardless of the selected features. Note that this download may be bigger than required, but where a large number of installations are going to be performed it is very useful to have a locally cached copy.
Execute the following command from Command Prompt to download all possible required files. Remember to substitute python-3.6.0.exe for the actual name of your installer, and to create layouts in their own directories to avoid collisions between files with the same name.
You may also specify the /quiet option to hide the progress display.
3.1.6. Modifying an install¶
Once Python has been installed, you can add or remove features through the Programs and Features tool that is part of Windows. Select the Python entry and choose “Uninstall/Change” to open the installer in maintenance mode.
“Repair” will verify all the files that should be installed using the current settings and replace any that have been removed or modified.
3.1.7. Other Platforms¶
With ongoing development of Python, some platforms that used to be supported earlier are no longer supported (due to the lack of users or developers). Check PEP 11 for details on all unsupported platforms.
See Python for Windows for detailed information about platforms with pre-compiled installers.
Python on XP “7 Minutes to “Hello World!”” by Richard Dooling, 2006 Installing on Windows in “Dive into Python: Python from novice to pro” by Mark Pilgrim, 2004, ISBN 1-59059-356-1 For Windows users in “Installing Python” in “A Byte of Python” by Swaroop C H, 2003
3.2. Alternative bundles¶
Besides the standard CPython distribution, there are modified packages including additional functionality. The following is a list of popular versions and their key features:
ActivePython Installer with multi-platform compatibility, documentation, PyWin32 Anaconda Popular scientific modules (such as numpy, scipy and pandas) and the conda package manager. Canopy A “comprehensive Python analysis environment” with editors and other development tools. WinPython Windows-specific distribution with prebuilt scientific packages and tools for building packages.
Note that these packages may not include the latest versions of Python or other libraries, and are not maintained or supported by the core Python team.
3.3. Configuring Python¶
3.3.1. Excursus: Setting environment variables¶
Windows allows environment variables to be configured permanently at both the User level and the System level, or temporarily in a command prompt.
To temporarily set environment variables, open Command Prompt and use the set command:
These changes will apply to any further commands executed in that console, and will be inherited by any applications started from the console.
Including the variable name within percent signs will expand to the existing value, allowing you to add your new value at either the start or the end. Modifying PATH by adding the directory containing python.exe to the start is a common way to ensure the correct version of Python is launched.
To permanently modify the default environment variables, click Start and search for ‘edit environment variables’, or open System properties, Advanced system settings and click the Environment Variables button. In this dialog, you can add or modify User and System variables. To change System variables, you need non-restricted access to your machine (i.e. Administrator rights).
The PYTHONPATH variable is used by all versions of Python 2 and Python 3, so you should not permanently configure this variable unless it only includes code that is compatible with all of your installed Python versions.
https://support.microsoft.com/kb/100843 Environment variables in Windows NT https://technet.microsoft.com/en-us/library/cc754250.aspx The SET command, for temporarily modifying environment variables https://technet.microsoft.com/en-us/library/cc755104.aspx The SETX command, for permanently modifying environment variables https://support.microsoft.com/kb/310519 How To Manage Environment Variables in Windows XP https://www.chem.gla.ac.uk/
louis/software/faq/q1.html Setting Environment variables, Louis J. Farrugia
3.3.2. Finding the Python executable¶
Changed in version 3.5.
Besides using the automatically created start menu entry for the Python interpreter, you might want to start Python in the command prompt. The installer has an option to set that up for you.
3.4. Python Launcher for Windows¶
The Python launcher for Windows is a utility which aids in locating and executing of different Python versions. It allows scripts (or the command-line) to indicate a preference for a specific Python version, and will locate and execute that version.
Unlike the PATH variable, the launcher will correctly select the most appropriate version of Python. It will prefer per-user installations over system-wide ones, and orders by language version rather than using the most recently installed version.
3.4.1. Getting started¶
3.4.1.1. From the command-line¶
Changed in version 3.6.
If you want the latest version of Python 2.x you have installed, try the command:
You should find the latest version of Python 2.x starts.
If you see the following error, you do not have the launcher installed:
Per-user installations of Python do not add the launcher to PATH unless the option was selected on installation.
3.4.1.2. Virtual environments¶
If the launcher is run with no explicit Python version specification, and a virtual environment (created with the standard library venv module or the external virtualenv tool) active, the launcher will run the virtual environment’s interpreter rather than the global one. To run the global interpreter, either deactivate the virtual environment, or explicitly specify the global Python version.
3.4.1.3. From a script¶
From the directory in which hello.py lives, execute the command:
You should notice the version number of your latest Python 2.x installation is printed. Now try changing the first line to be:
Re-executing the command should now print the latest Python 3.x information. As with the above command-line examples, you can specify a more explicit version qualifier. Assuming you have Python 2.6 installed, try changing the first line to #! python2.6 and you should find the 2.6 version information printed.
Note that unlike interactive use, a bare “python” will use the latest version of Python 2.x that you have installed. This is for backward compatibility and for compatibility with Unix, where the command python typically refers to Python 2.
3.4.1.4. From file associations¶
The key benefit of this is that a single launcher can support multiple Python versions at the same time depending on the contents of the first line.
3.4.2. Shebang Lines¶
To allow shebang lines in Python scripts to be portable between Unix and Windows, this launcher supports a number of ‘virtual’ commands to specify which interpreter to use. The supported virtual commands are:
For example, if the first line of your script starts with
The /usr/bin/env form of shebang line has one further special property. Before looking for installed Python interpreters, this form will search the executable PATH for a Python executable. This corresponds to the behaviour of the Unix env program, which performs a PATH search.
3.4.3. Arguments in shebang lines¶
The shebang lines can also specify additional options to be passed to the Python interpreter. For example, if you have a shebang line:
3.4.4. Customization¶
3.4.4.1. Customization via INI files¶
3.4.4.2. Customizing default Python versions¶
In some cases, a version qualifier can be included in a command to dictate which version of Python will be used by the command. A version qualifier starts with a major version number and can optionally be followed by a period (‘.’) and a minor version specifier. If the minor qualifier is specified, it may optionally be followed by “-32” to indicate the 32-bit implementation of that version be used.
For example, a shebang line of #!python has no version qualifier, while #!python3 has a version qualifier which specifies only a major version.
If no minor version qualifiers are found, the environment variable PY_PYTHON (where is the current major version qualifier as determined above) can be set to specify the full version. If no such option is found, the launcher will enumerate the installed Python versions and use the latest minor release found for the major version, which is likely, although not guaranteed, to be the most recently installed version in that family.
3.4.5. Diagnostics¶
If an environment variable PYLAUNCH_DEBUG is set (to any value), the launcher will print diagnostic information to stderr (i.e. to the console). While this information manages to be simultaneously verbose and terse, it should allow you to see what versions of Python were located, why a particular version was chosen and the exact command-line used to execute the target Python.
3.5. Finding modules¶
If a pyvenv.cfg file is found alongside the main executable or in the directory one level above the executable, the following variations apply:
The end result of all this is:
For those who want to bundle Python into their application or distribution, the following advice will prevent conflicts with other installations:
These will ensure that the files in a system-wide installation will not take precedence over the copy of the standard library bundled with your application. Otherwise, your users may experience problems using your application. Note that the first suggestion is the best, as the other may still be susceptible to non-standard paths in the registry and user site-packages.
3.6. Additional modules¶
Even though Python aims to be portable among all platforms, there are features that are unique to Windows. A couple of modules, both in the standard library and external, and snippets exist to use these features.
3.6.1. PyWin32¶
The PyWin32 module by Mark Hammond is a collection of modules for advanced Windows-specific support. This includes utilities for:
PythonWin is a sample MFC application shipped with PyWin32. It is an embeddable IDE with a built-in debugger.
Win32 How Do I. by Tim Golden Python and COM by David and Paul Boddie
3.6.2. cx_Freeze¶
3.6.3. WConio¶
3.7. Compiling Python on Windows¶
If you want to compile CPython yourself, first thing you should do is get the source. You can download either the latest release’s source or just grab a fresh checkout.
The source tree contains a build solution and project files for Microsoft Visual Studio 2015, which is the compiler used to build the official Python releases. These files are in the PCbuild directory.
Check PCbuild/readme.txt for general information on the build process.
Python + Windows + distutils + SWIG + gcc MinGW or “Creating Python extensions in C/C++ with SWIG and compiling them with MinGW gcc under Windows” or “Installing Python extension with distutils and without Microsoft Visual C++” by Sébastien Sauvage, 2003 MingW – Python extensions by Trent Apted et al, 2007
3.8. Embedded Distribution¶
The embedded distribution is a ZIP file containing a minimal Python environment. It is intended for acting as part of another application, rather than being directly accessed by end-users.
The embedded distribution does not include the Microsoft C Runtime and it is the responsibility of the application installer to provide this. The runtime may have already been installed on a user’s system previously or automatically via Windows Update, and can be detected by finding ucrtbase.dll in the system directory.
Third-party packages should be installed by the application installer alongside the embedded distribution. Using pip to manage dependencies as for a regular Python installation is not supported with this distribution, though with some care it may be possible to include and use pip for automatic updates. In general, third-party packages should be treated as part of the application (“vendoring”) so that the developer can ensure compatibility with newer versions before providing updates to users.
The two recommended use cases for this distribution are described below.
3.8.1. Python Application¶
An application written in Python does not necessarily require users to be aware of that fact. The embedded distribution may be used in this case to include a private version of Python in an install package. Depending on how transparent it should be (or conversely, how professional it should appear), there are two options.
Using a specialized executable as a launcher requires some coding, but provides the most transparent experience for users. With a customized launcher, there are no obvious indications that the program is running on Python: icons can be customized, company and version information can be specified, and file associations behave properly. In most cases, a custom launcher should simply be able to call Py_Main with a hard-coded command line.
The simpler approach is to provide a batch file or generated shortcut that directly calls the python.exe or pythonw.exe with the required command-line arguments. In this case, the application will appear to be Python and not its actual name, and users may have trouble distinguishing it from other running Python processes or file associations.
With the latter approach, packages should be installed as directories alongside the Python executable to ensure they are available on the path. With the specialized launcher, packages can be located in other locations as there is an opportunity to specify the search path before launching the application.
3.8.2. Embedding Python¶
As with the application use, packages can be installed to any location as there is an opportunity to specify search paths before initializing the interpreter. Otherwise, there is no fundamental differences between using the embedded distribution and a regular installation.
Источник
Содержание
- Плагин matplotlib Python при переустановке Windows 10 не работает. Почему?
- Установка Python на Windows
- Рассмотрим установку языка программирования на Windows Server 2012, хотя установка на Windows 7, Windows 10 будет типовой.
- How to install Python on Windows | Opensource.com
- Install Python, run an IDE, and start coding right from your Microsoft Windows desktop.
- Subscribe now
- Get Python
- win-python-install.jpg
- Install Python
- win-python-path.jpg
- win-python-publisher.jpg
- Install an IDE
- IDLE 3
- idle3.png
- PyCharm IDE
- Tell Python what to do
- How do I install Python packages on Windows?
- 12 Answers 12
- 3. Using Python on Windows¶
- 3.1. Installing Python¶
- 3.1.1. Supported Versions¶
- 3.1.2. Installation Steps¶
- 3.1.3. Removing the MAX_PATH Limitation¶
- 3.1.4. Installing Without UI¶
- 3.1.5. Installing Without Downloading¶
- 3.1.6. Modifying an install¶
- 3.1.7. Other Platforms¶
- 3.2. Alternative bundles¶
- 3.3. Configuring Python¶
- 3.3.1. Excursus: Setting environment variables¶
- 3.3.2. Finding the Python executable¶
- 3.4. Python Launcher for Windows¶
- 3.4.1. Getting started¶
- 3.4.1.1. From the command-line¶
- 3.4.1.2. Virtual environments¶
- 3.4.1.3. From a script¶
- 3.4.1.4. From file associations¶
- 3.4.2. Shebang Lines¶
- 3.4.3. Arguments in shebang lines¶
- 3.4.4. Customization¶
- 3.4.4.1. Customization via INI files¶
- 3.4.4.2. Customizing default Python versions¶
- 3.4.5. Diagnostics¶
- 3.5. Finding modules¶
- 3.6. Additional modules¶
- 3.6.1. PyWin32¶
- 3.6.2. cx_Freeze¶
- 3.6.3. WConio¶
- 3.7. Compiling Python on Windows¶
- 3.8. Embedded Distribution¶
- 3.8.1. Python Application¶
- 3.8.2. Embedding Python¶
- 3.9. Other resources¶
- Видео
Плагин matplotlib Python при переустановке Windows 10 не работает. Почему?
В инфернете пишут, что может мешать библиотека freetype.dll от другого приложения (например, от java).
Рекомендуют попробовать так поменять системный path, чтобы папка python, anaconda и других пайтоновских приложений были раньше папки java. Тогда, якобы, оно будет правильную библиотеку находить раньше.
Сам не проверял, дома винды нету вааще.
На Windows 10 нужно понизить версию:
И да, matplotlib это не плагин, а библиотека.
BUILDING MATPLOTLIB
matplotlib: yes [3.0.3]
python: yes [3.8.6 (tags/v3.8.6:db45529, Sep 23 2020,
15:52:53) [MSC v.1927 64 bit (AMD64)]]
platform: yes [win32]
REQUIRED DEPENDENCIES AND EXTENSIONS
numpy: yes [version 1.19.2]
install_requires: yes [handled by setuptools]
libagg: yes [pkg-config information for ‘libagg’ could not
be found. Using local copy.]
freetype: no [The C/C++ header for freetype
(freetype2ft2build.h) could not be found. You may
need to install the development package.]
png: no [The C/C++ header for png (png.h) could not be
found. You may need to install the development
package.]
qhull: yes [pkg-config information for ‘libqhull’ could not
be found. Using local copy.]
OPTIONAL SUBPACKAGES
sample_data: yes [installing]
toolkits: yes [installing]
tests: no [skipping due to configuration]
toolkits_tests: no [skipping due to configuration]
OPTIONAL BACKEND EXTENSIONS
agg: yes [installing]
tkagg: yes [installing; run-time loading from Python Tcl /
Tk]
macosx: no [Mac OS-X only]
windowing: yes [installing]
OPTIONAL PACKAGE DATA
dlls: no [skipping due to configuration]
============================================================================
* The following required packages can not be built:
* freetype, png
* Please check gnuwin32.sourceforge.net/packa
* ges/freetype.htm for instructions to install
* freetype
* Please check gnuwin32.sourceforge.net/packa
* ges/libpng.htm for instructions to install png
—————————————-
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
3 разных компьютера и одна ошибка. Образ Windows 10 брался с официального сайта. Уже установлен MS C++ 2015. Что именно не так с компьютерами или что не так я делаю?
Источник
Установка Python на Windows
Рассмотрим установку языка программирования на Windows Server 2012, хотя установка на Windows 7, Windows 10 будет типовой.
Итак, для установки нам потребуется дистрибутив Python версию которой выбираем и скачиваем по ссылке: https://www.python.org/downloads/
Скачать Python для windows
Выбираем установку для всех пользователей:
Выбираем установку для всех пользователей
Выбираем директорию для установки, я оставляю по умолчанию C:Python27:
Выбираем директорию для установки
Далее по умолчанию нажимаем NEXT, NEXT до окончания установки:
Теперь необходимо проверить добавился ли путь для командной строки.
В диспетчере задач нажимаем Run new task:
Запускаем новую задачу Run new task
Набираем cmd и жмем ENTER:
Запускаем окно терминала
В окне терминала набираем python и жмем Enter, если выдаст информацию, то на этом инсталляция закончена.
У меня, как всегда, просто не получается и python выдает ошибку:
В этом же окне терминала набираем sysdm.cpl и попадаем в System Properties:
Набираем sysdm.cpl — Enter
Теперь нужно зайти в закладку Advanced и нажать кнопку Environment Variables:
Редактируем Path, добавляем в конце через точку с запятой путь куда установили Python, у меня это выглядит так — ;C:Python27:
Открываем Path Дописываем пути ;C:Python27
Теперь пробуем прописать python, но сделать это нужно в новом окне терминала, который подтянет наши записи:
Python 2.7.14 установлен
Вот теперь установка Python закончена и можно работать.
Источник
How to install Python on Windows | Opensource.com
Install Python, run an IDE, and start coding right from your Microsoft Windows desktop.
Subscribe now
Get the highlights in your inbox every week.
So you want to learn to program? One of the most common languages to start with is Python, popular for its unique blend of object-oriented structure and simple syntax. Python is also an interpreted language, meaning you don’t need to learn how to compile code into machine language: Python does that for you, allowing you to test your programs sometimes instantly and, in a way, while you write your code.
Just because Python is easy to learn doesn’t mean you should underestimate its potential power. Python is used by movie studios, financial institutions, IT houses, video game studios, makers, hobbyists, artists, teachers, and many others.
On the other hand, Python is also a serious programming language, and learning it takes dedication and practice. Then again, you don’t have to commit to anything just yet. You can install and try Python on nearly any computing platform, so if you’re on Windows, this article is for you.
If you want to try Python on a completely open source operating system, you can install Linux and then try Python.
Get Python
Python is available from its website, Python.org. Once there, hover your mouse over the Downloads menu, then over the Windows option, and then click the button to download the latest release.
win-python-install.jpg
Alternatively, you can click the Downloads menu button and select a specific version from the downloads page.
Install Python
Once the package is downloaded, open it to start the installer.
It is safe to accept the default install location, and it’s vital to add Python to PATH. If you don’t add Python to your PATH, then Python applications won’t know where to find Python (which they require in order to run). This is not selected by default, so activate it at the bottom of the install window before continuing!
win-python-path.jpg
Before Windows allows you to install an application from a publisher other than Microsoft, you must give your approval. Click the Yes button when prompted by the User Account Control system.
win-python-publisher.jpg
Wait patiently for Windows to distribute the files from the Python package into the appropriate locations, and when it’s finished, you’re done installing Python.
Install an IDE
To write programs in Python, all you really need is a text editor, but it’s convenient to have an integrated development environment (IDE). An IDE integrates a text editor with some friendly and helpful Python features. IDLE 3 and Pycharm (Community Edition) are two great open source options to consider.
IDLE 3
Python comes with an IDE called IDLE. You can write code in any text editor, but using an IDE provides you with keyword highlighting to help detect typos, a Run button to test code quickly and easily, and other code-specific features that a plain text editor like Notepad++ normally doesn’t have.
To start IDLE, click the Start (or Window) menu and type python for matches. You may find a few matches, since Python provides more than one interface, so make sure you launch IDLE.
idle3.png
If you don’t see Python in the Start menu, reinstall Python. Be sure to select Add Python to PATH in the install wizard. Refer to the Python docs for detailed instructions.
PyCharm IDE
If you already have some coding experience and IDLE seems too simple for you, try PyCharm (Community Edition), an open source IDE for Python. It has keyword highlighting to help detect typos, quotation and parenthesis completion to avoid syntax errors, line numbers (helpful when debugging), indentation markers, and a Run button to test code quickly and easily.
To install it, visit the PyCharm IDE website, download the installer, and run it. The process is the same as with Python: start the installer, allow Windows to install a non-Microsoft application, and wait for the installer to finish.
Once PyCharm is installed, double-click the PyCharm icon on your desktop or select it from the Start menu.
Tell Python what to do
Keywords tell Python what you want it to do. In IDLE, go to the File menu and create a new file. In PyCharm, click the New Project button.
In your new, empty file, type this into IDLE or PyCharm:
Источник
How do I install Python packages on Windows?
I’m having a hard time setting up python packages. EasyInstall from SetupTools is supposed to help that, but they don’t have an executable for Python 2.6.
For instance to install Mechanize, I’m just supposed to put the Mechanize folder in C:Python24Libsite-packages according to INSTALL.txt, but runnning the tests does not work. Can someone help shed some light on this? Thanks!
12 Answers 12
Newer versions of Python for Windows come with the pip package manager. (source)
pip is already installed if you’re using Python 2 >=2.7.9 or Python 3 >=3.4
Use that to install packages:
So in your case it’d be:
This is a good tutorial on how to get easy_install on windows. The short answer: add C:Python26Scripts (or whatever python you have installed) to your PATH.
You don’t need the executable for setuptools. You can download the source code, unpack it, traverse to the downloaded directory and run python setup.py install in the command prompt
Starting with Python 2.7, pip is included by default. Simply download your desired package via
Packaging in Python is dire. The root cause is that the language ships without a package manager.
Fortunately, there is one package manager for Python, called Pip. Pip is inspired by Ruby’s Gem, but lacks some features. Ironically, Pip itself is complicated to install. Installation on the popular 64-bit Windows demands building and installing two packages from source. This is a big ask for anyone new to programming.
So the right thing to do is to install pip. However if you can’t be bothered, Christoph Gohlke provides binaries for popular Python packages for all Windows platforms http://www.lfd.uci.edu/
In fact, building some Python packages requires a C compiler (eg. mingw32) and library headers for the dependencies. This can be a nightmare on Windows, so remember the name Christoph Gohlke.
I had problems in installing packages on Windows. Found the solution. It works in Windows7+. Mainly anything with Windows Powershell should be able to make it work. This can help you get started with it.
That worked for me when nothing else was making any sense. I use Python 2.7 but the documentation suggests that same would work for Python 3.x also.
Источник
3. Using Python on Windows¶
This document aims to give an overview of Windows-specific behaviour you should know about when using Python on Microsoft Windows.
3.1. Installing Python¶
Unlike most Unix systems and services, Windows does not include a system supported installation of Python. To make Python available, the CPython team has compiled Windows installers (MSI packages) with every release for many years. These installers are primarily intended to add a per-user installation of Python, with the core interpreter and library being used by a single user. The installer is also able to install for all users of a single machine, and a separate ZIP file is available for application-local distributions.
3.1.1. Supported Versions¶
As specified in PEP 11, a Python release only supports a Windows platform while Microsoft considers the platform under extended support. This means that Python 3.7 supports Windows Vista and newer. If you require Windows XP support then please install Python 3.4.
3.1.2. Installation Steps¶
After starting the installer, one of two options may be selected:
If you select “Install Now”:
Selecting “Customize installation” will allow you to select the features to install, the installation location and other options or post-install actions. To install debugging symbols or binaries, you will need to use this option.
To perform an all-users installation, you should select “Customize installation”. In this case:
3.1.3. Removing the MAX_PATH Limitation¶
Windows historically has limited path lengths to 260 characters. This meant that paths longer than this would not resolve and errors would result.
This allows the open() function, the os module and most other path functionality to accept and return paths longer than 260 characters when using strings. (Use of bytes as paths is deprecated on Windows, and this feature is not available when using bytes.)
After changing the above option, no further configuration is required.
Changed in version 3.6: Support for long paths was enabled in Python.
3.1.4. Installing Without UI¶
All of the options available in the installer UI can also be specified from the command line, allowing scripted installers to replicate an installation on many machines without user interaction. These options may also be set without suppressing the UI in order to change some of the defaults.
For example, to silently install a default, system-wide Python installation, you could use the following command (from an elevated command prompt):
To allow users to easily install a personal copy of Python without the test suite, you could provide a shortcut with the following command. This will display a simplified initial page and disallow customization:
(Note that omitting the launcher also omits file associations, and is only recommended for per-user installs when there is also a system-wide installation that included the launcher.)
The options listed above can also be provided in a file named unattend.xml alongside the executable. This file specifies a list of options and values. When a value is provided as an attribute, it will be converted to a number if possible. Values provided as element text are always left as strings. This example file sets the same options and the previous example:
3.1.5. Installing Without Downloading¶
As some features of Python are not included in the initial installer download, selecting those features may require an internet connection. To avoid this need, all possible components may be downloaded on-demand to create a complete layout that will no longer require an internet connection regardless of the selected features. Note that this download may be bigger than required, but where a large number of installations are going to be performed it is very useful to have a locally cached copy.
Execute the following command from Command Prompt to download all possible required files. Remember to substitute python-3.6.0.exe for the actual name of your installer, and to create layouts in their own directories to avoid collisions between files with the same name.
You may also specify the /quiet option to hide the progress display.
3.1.6. Modifying an install¶
Once Python has been installed, you can add or remove features through the Programs and Features tool that is part of Windows. Select the Python entry and choose “Uninstall/Change” to open the installer in maintenance mode.
“Repair” will verify all the files that should be installed using the current settings and replace any that have been removed or modified.
3.1.7. Other Platforms¶
With ongoing development of Python, some platforms that used to be supported earlier are no longer supported (due to the lack of users or developers). Check PEP 11 for details on all unsupported platforms.
See Python for Windows for detailed information about platforms with pre-compiled installers.
Python on XP “7 Minutes to “Hello World!”” by Richard Dooling, 2006 Installing on Windows in “Dive into Python: Python from novice to pro” by Mark Pilgrim, 2004, ISBN 1-59059-356-1 For Windows users in “Installing Python” in “A Byte of Python” by Swaroop C H, 2003
3.2. Alternative bundles¶
Besides the standard CPython distribution, there are modified packages including additional functionality. The following is a list of popular versions and their key features:
ActivePython Installer with multi-platform compatibility, documentation, PyWin32 Anaconda Popular scientific modules (such as numpy, scipy and pandas) and the conda package manager. Canopy A “comprehensive Python analysis environment” with editors and other development tools. WinPython Windows-specific distribution with prebuilt scientific packages and tools for building packages.
Note that these packages may not include the latest versions of Python or other libraries, and are not maintained or supported by the core Python team.
3.3. Configuring Python¶
3.3.1. Excursus: Setting environment variables¶
Windows allows environment variables to be configured permanently at both the User level and the System level, or temporarily in a command prompt.
To temporarily set environment variables, open Command Prompt and use the set command:
These changes will apply to any further commands executed in that console, and will be inherited by any applications started from the console.
Including the variable name within percent signs will expand to the existing value, allowing you to add your new value at either the start or the end. Modifying PATH by adding the directory containing python.exe to the start is a common way to ensure the correct version of Python is launched.
To permanently modify the default environment variables, click Start and search for ‘edit environment variables’, or open System properties, Advanced system settings and click the Environment Variables button. In this dialog, you can add or modify User and System variables. To change System variables, you need non-restricted access to your machine (i.e. Administrator rights).
The PYTHONPATH variable is used by all versions of Python 2 and Python 3, so you should not permanently configure this variable unless it only includes code that is compatible with all of your installed Python versions.
https://support.microsoft.com/kb/100843 Environment variables in Windows NT https://technet.microsoft.com/en-us/library/cc754250.aspx The SET command, for temporarily modifying environment variables https://technet.microsoft.com/en-us/library/cc755104.aspx The SETX command, for permanently modifying environment variables https://support.microsoft.com/kb/310519 How To Manage Environment Variables in Windows XP https://www.chem.gla.ac.uk/
louis/software/faq/q1.html Setting Environment variables, Louis J. Farrugia
3.3.2. Finding the Python executable¶
Changed in version 3.5.
Besides using the automatically created start menu entry for the Python interpreter, you might want to start Python in the command prompt. The installer has an option to set that up for you.
3.4. Python Launcher for Windows¶
The Python launcher for Windows is a utility which aids in locating and executing of different Python versions. It allows scripts (or the command-line) to indicate a preference for a specific Python version, and will locate and execute that version.
Unlike the PATH variable, the launcher will correctly select the most appropriate version of Python. It will prefer per-user installations over system-wide ones, and orders by language version rather than using the most recently installed version.
3.4.1. Getting started¶
3.4.1.1. From the command-line¶
Changed in version 3.6.
If you want the latest version of Python 2.x you have installed, try the command:
You should find the latest version of Python 2.x starts.
If you see the following error, you do not have the launcher installed:
Per-user installations of Python do not add the launcher to PATH unless the option was selected on installation.
3.4.1.2. Virtual environments¶
If the launcher is run with no explicit Python version specification, and a virtual environment (created with the standard library venv module or the external virtualenv tool) active, the launcher will run the virtual environment’s interpreter rather than the global one. To run the global interpreter, either deactivate the virtual environment, or explicitly specify the global Python version.
3.4.1.3. From a script¶
From the directory in which hello.py lives, execute the command:
You should notice the version number of your latest Python 2.x installation is printed. Now try changing the first line to be:
Re-executing the command should now print the latest Python 3.x information. As with the above command-line examples, you can specify a more explicit version qualifier. Assuming you have Python 2.6 installed, try changing the first line to #! python2.6 and you should find the 2.6 version information printed.
Note that unlike interactive use, a bare “python” will use the latest version of Python 2.x that you have installed. This is for backward compatibility and for compatibility with Unix, where the command python typically refers to Python 2.
3.4.1.4. From file associations¶
The key benefit of this is that a single launcher can support multiple Python versions at the same time depending on the contents of the first line.
3.4.2. Shebang Lines¶
To allow shebang lines in Python scripts to be portable between Unix and Windows, this launcher supports a number of ‘virtual’ commands to specify which interpreter to use. The supported virtual commands are:
For example, if the first line of your script starts with
The /usr/bin/env form of shebang line has one further special property. Before looking for installed Python interpreters, this form will search the executable PATH for a Python executable. This corresponds to the behaviour of the Unix env program, which performs a PATH search.
3.4.3. Arguments in shebang lines¶
The shebang lines can also specify additional options to be passed to the Python interpreter. For example, if you have a shebang line:
3.4.4. Customization¶
3.4.4.1. Customization via INI files¶
3.4.4.2. Customizing default Python versions¶
In some cases, a version qualifier can be included in a command to dictate which version of Python will be used by the command. A version qualifier starts with a major version number and can optionally be followed by a period (‘.’) and a minor version specifier. If the minor qualifier is specified, it may optionally be followed by “-32” to indicate the 32-bit implementation of that version be used.
For example, a shebang line of #!python has no version qualifier, while #!python3 has a version qualifier which specifies only a major version.
If no minor version qualifiers are found, the environment variable PY_PYTHON (where is the current major version qualifier as determined above) can be set to specify the full version. If no such option is found, the launcher will enumerate the installed Python versions and use the latest minor release found for the major version, which is likely, although not guaranteed, to be the most recently installed version in that family.
3.4.5. Diagnostics¶
If an environment variable PYLAUNCH_DEBUG is set (to any value), the launcher will print diagnostic information to stderr (i.e. to the console). While this information manages to be simultaneously verbose and terse, it should allow you to see what versions of Python were located, why a particular version was chosen and the exact command-line used to execute the target Python.
3.5. Finding modules¶
If a pyvenv.cfg file is found alongside the main executable or in the directory one level above the executable, the following variations apply:
The end result of all this is:
For those who want to bundle Python into their application or distribution, the following advice will prevent conflicts with other installations:
These will ensure that the files in a system-wide installation will not take precedence over the copy of the standard library bundled with your application. Otherwise, your users may experience problems using your application. Note that the first suggestion is the best, as the other may still be susceptible to non-standard paths in the registry and user site-packages.
3.6. Additional modules¶
Even though Python aims to be portable among all platforms, there are features that are unique to Windows. A couple of modules, both in the standard library and external, and snippets exist to use these features.
3.6.1. PyWin32¶
The PyWin32 module by Mark Hammond is a collection of modules for advanced Windows-specific support. This includes utilities for:
PythonWin is a sample MFC application shipped with PyWin32. It is an embeddable IDE with a built-in debugger.
Win32 How Do I. by Tim Golden Python and COM by David and Paul Boddie
3.6.2. cx_Freeze¶
3.6.3. WConio¶
3.7. Compiling Python on Windows¶
If you want to compile CPython yourself, first thing you should do is get the source. You can download either the latest release’s source or just grab a fresh checkout.
The source tree contains a build solution and project files for Microsoft Visual Studio 2015, which is the compiler used to build the official Python releases. These files are in the PCbuild directory.
Check PCbuild/readme.txt for general information on the build process.
Python + Windows + distutils + SWIG + gcc MinGW or “Creating Python extensions in C/C++ with SWIG and compiling them with MinGW gcc under Windows” or “Installing Python extension with distutils and without Microsoft Visual C++” by Sébastien Sauvage, 2003 MingW – Python extensions by Trent Apted et al, 2007
3.8. Embedded Distribution¶
The embedded distribution is a ZIP file containing a minimal Python environment. It is intended for acting as part of another application, rather than being directly accessed by end-users.
The embedded distribution does not include the Microsoft C Runtime and it is the responsibility of the application installer to provide this. The runtime may have already been installed on a user’s system previously or automatically via Windows Update, and can be detected by finding ucrtbase.dll in the system directory.
Third-party packages should be installed by the application installer alongside the embedded distribution. Using pip to manage dependencies as for a regular Python installation is not supported with this distribution, though with some care it may be possible to include and use pip for automatic updates. In general, third-party packages should be treated as part of the application (“vendoring”) so that the developer can ensure compatibility with newer versions before providing updates to users.
The two recommended use cases for this distribution are described below.
3.8.1. Python Application¶
An application written in Python does not necessarily require users to be aware of that fact. The embedded distribution may be used in this case to include a private version of Python in an install package. Depending on how transparent it should be (or conversely, how professional it should appear), there are two options.
Using a specialized executable as a launcher requires some coding, but provides the most transparent experience for users. With a customized launcher, there are no obvious indications that the program is running on Python: icons can be customized, company and version information can be specified, and file associations behave properly. In most cases, a custom launcher should simply be able to call Py_Main with a hard-coded command line.
The simpler approach is to provide a batch file or generated shortcut that directly calls the python.exe or pythonw.exe with the required command-line arguments. In this case, the application will appear to be Python and not its actual name, and users may have trouble distinguishing it from other running Python processes or file associations.
With the latter approach, packages should be installed as directories alongside the Python executable to ensure they are available on the path. With the specialized launcher, packages can be located in other locations as there is an opportunity to specify the search path before launching the application.
3.8.2. Embedding Python¶
As with the application use, packages can be installed to any location as there is an opportunity to specify search paths before initializing the interpreter. Otherwise, there is no fundamental differences between using the embedded distribution and a regular installation.
3.9. Other resources¶
Источник
Видео
111 / 98 / 68 Регистрация: 21.04.2014 Сообщений: 1,385 |
|
1 |
|
Подключить интерпретатор21.01.2020, 20:08. Показов 67072. Ответов 1
Здравствуйте.
0 |
19 / 14 / 6 Регистрация: 21.01.2020 Сообщений: 49 |
|
22.01.2020, 17:17 |
2 |
Когда интерпретатор не добавлен, выглядит всё примерно так: Вы должны нажать Ctrl+Alt+S для вызова настроек. В настройках необходимо выбрать слева Project Interpreter, далее справа от строки с таким же названием Project Interpreter нажать на шестеренку и выбрать Add Откроется окошко в котором нужно нажать ОК(если как вы говорите в консоли питон работает, значит Pycharm должен подхватить интерпретатор сам) Далее тоже ОК Спустя несколько секунд в правой нижней части увидите версию интерпретатора, можно работать
3 |
Skip to content
HOME
This tutorial will explain the step-by-step process to download and install PyCharm on Windows.
Prerequisite:
Python is already installed on the machine.
You can refer to this tutorial to install Python on Windows 11.
Installation Steps
Step 1 – To download PyCharm visit the website https://www.jetbrains.com/pycharm/download/, and it will give you two options: Professional or Community. The professional edition of PyCharm requires a subscription, while the community edition is free. Click the “DOWNLOAD” button under the Community Section.
Step 2 – Once the download is complete, run the exe to install PyCharm. The setup wizard should have started. Click the “Next” button.
Step 3 – On the next screen, Change the installation path if required. Click the “Next” button.
Step 4 – On the next screen, you can create a desktop shortcut if you want, Add Open Folder as Project, Create Associations, Update PATH variable (restart needed), and click on the “Next” button.
Step 5 – Choose the start menu folder. Keep selecting JetBrains and click on the “Install” button.
Step 6 – Wait for the installation to finish.
Step 7 – Once the installation is finished, you should receive a message screen that PyCharm is installed. You can select either of the options – Reboot now or I want to manually reboot later and click the “Finish” button.
Step 8 – After you click on the “Finish” button, the following screen will appear. I already have created a new project, so you can see the RobotFramework project here.