Hello! I’m a bot!
It looks to me like your post might be better suited for r/learnpython, a sub geared towards questions and learning more about python regardless of how advanced your question might be. That said, I am a bot and it is hard to tell. Please follow the subs rules and guidelines when you do post there, it’ll help you get better answers faster.
Show r/learnpython the code you have tried and describe in detail where you are stuck. If you are getting an error message, include the full block of text it spits out. Quality answers take time to write out, and many times other users will need to ask clarifying questions. Be patient and help them help you. Here is HOW TO FORMAT YOUR CODE For Reddit and be sure to include which version of python and what OS you are using.
You can also ask this question in the Python discord, a large, friendly community focused around the Python programming language, open to those who wish to learn the language or improve their skills, as well as those looking to help others.
README | FAQ | this bot is written and managed by /u/IAmKindOfCreative
This bot is currently under development and experiencing changes to improve its usefulness
Table of Contents
Hide
- How to solve Python was not found; run without arguments to install from the Microsoft Store
- Scenario 1: Python is not installed
- Scenario 2: Environment variables are not set properly
- Scenario 3: Manage App Execution Aliases
- Scenario 4: Clean Install
If you have not installed Python on your windows machine or if the path environment variables are not set properly in windows you will get Python was not found error.
In this tutorial, we will learn how to resolve Python was not found; run without arguments to install from the Microsoft Store error
The error mainly occurs in the windows operating system and there are different reasons to get this issue. Let us take a look at each of these scenarios and solutions.
Scenario 1: Python is not installed
The main reason could be that Python software itself is not installed on the windows machine and, you are trying to execute Python scripts or installing the packages.
This is a rare scenario where some beginners think that by default the Python software is shipped with windows and try to run the Python scripts.
Solution
The solution is pretty straightforward and, we can download the latest version of Python from the official source and install it in windows to resolve the issue.
Scenario 2: Environment variables are not set properly
The second scenario could be you have installed the Python software, but when you run the scripts or the project through the command line, you get Python was not found error.
It happens because the environment path variable does not exist for Python.
Solution
You can resolve the issue by setting the environment path variable for Python as shown below.
Step 1: Find the installed path of the Python software if you have installed it in a different location. The default installation path for Python 3.7+ versions is located as shown below.
Step 2: Copy the two Python paths. Replace the <user_name> with your actual user name.
C:\Users\<user_name>\AppData\Local\Programs\Python\Python39
C:\Users\<user_name>\AppData\Local\Programs\Python\Python39\Scripts
Step 3: These are the Path for the Python interpreter. We need to add this into the system environment variable Path as shown in the below screenshot.
Right-click This PC, then go to Properties => Advanced system settings => Environment variables.
Step 4: You’ll see your variables here. Select the PATH variable and click the “Edit” button. In the window that appears when a path variable exists, select it and click Edit; otherwise, click New.
Step 5: Finally, paste the path you copied earlier in Step 1. If your system has many paths linked by semicolons, append the path by prefacing it with a semicolon. Click Ok to save.
Once you have completed all the steps, try running the Python program from your command prompt. You can run the ‘py’ or ‘python’ command, and you should not see any error hereafter. Remember to close all the command prompt windows and reopen them again after completing the above steps.
Step 5: Restart the machine once and try running the scripts.
Scenario 3: Manage App Execution Aliases
In Windows start, search for Manage App Execution Aliases and turn of the app installers for Python as shown in the below screenshot.
Scenario 4: Clean Install
If you have tried all the above methods and still it did not work, then you can uninstall the existing Python installation and perform a clean installation of Python.
During the installation, ensure to Add the Path environment variables to set the paths properly.
Once you re-install the Python, ensure to reboot the windows machine before executing the Python scripts.
Srinivas Ramakrishna is a Solution Architect and has 14+ Years of Experience in the Software Industry. He has published many articles on Medium, Hackernoon, dev.to and solved many problems in StackOverflow. He has core expertise in various technologies such as Microsoft .NET Core, Python, Node.JS, JavaScript, Cloud (Azure), RDBMS (MSSQL), React, Powershell, etc.
Sign Up for Our Newsletters
Subscribe to get notified of the latest articles. We will never spam you. Be a part of our ever-growing community.
By checking this box, you confirm that you have read and are agreeing to our terms of use regarding the storage of the data submitted through this form.
Содержание
- 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 matplotlib install issue on Windows 7 for freetype, png packages
- 8 Answers 8
Плагин matplotlib Python при переустановке Windows 10 не работает. Почему?
>>> import matplotlib.pyplot
Traceback (most recent call last):
File «», line 1, in
import matplotlib.pyplot
File «C:\Users\admin\AppData\Local\Programs\Python\Python38\lib\site-packages\matplotlib\__init__.py», line 174, in
_check_versions()
File «C:\Users\admin\AppData\Local\Programs\Python\Python38\lib\site-packages\matplotlib\__init__.py», line 159, in _check_versions
from . import ft2font
ImportError: DLL load failed while importing ft2font: Не найден указанный модуль.
Пробовал устанавливать с нуля Windows 10 на трех разных новых компьютерах и с процессорами Intel Core i3, i5 тоже не работает.
Переустановил Windows 10 на свой старый комп: мать Gigabyte, проц AMD Phenom, видео GeForce GT 710 — та же ерунда, как на скриншоте.
Что вообще происходить и как это решить?
- Вопрос задан 14 окт. 2020
- 449 просмотров
В инфернете пишут, что может мешать библиотека freetype.dll от другого приложения (например, от java).
Рекомендуют попробовать так поменять системный path, чтобы папка python, anaconda и других пайтоновских приложений были раньше папки java. Тогда, якобы, оно будет правильную библиотеку находить раньше.
Сам не проверял, дома винды нету вааще.
На Windows 10 нужно понизить версию:
И да, matplotlib это не плагин, а библиотека.
C:\Users\admin>pip install matplotlib==3.0.3
Collecting matplotlib==3.0.3
Downloading matplotlib-3.0.3.tar.gz (36.6 MB)
|████████████████████████████████| 36.6 MB 6.4 MB/s
ERROR: Command errored out with exit status 1:
command: ‘c:\users\admin\appdata\local\programs\python\python38\python.exe’ -c ‘import sys, setuptools, tokenize; sys.argv[0] = ‘»‘»‘C:\\Users\\admin\\AppData\\Local\\Temp\\pip-install-p05r85k1\\matplotlib\\setup.py’»‘»‘; __file__=’»‘»‘C:\\Users\\admin\\AppData\\Local\\Temp\\pip-install-p05r85k1\\matplotlib\\setup.py’»‘»‘;f=getattr(tokenize, ‘»‘»‘open’»‘»‘, open)(__file__);code=f.read().replace(‘»‘»‘\r\n’»‘»‘, ‘»‘»‘\n’»‘»‘);f.close();exec(compile(code, __file__, ‘»‘»‘exec’»‘»‘))’ egg_info —egg-base ‘C:\Users\admin\AppData\Local\Temp\pip-pip-egg-info-do3clo40’
cwd: C:\Users\admin\AppData\Local\Temp\pip-install-p05r85k1\matplotlib\
Complete output (47 lines):
============================================================================
Edit setup.cfg to change the build options
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 matplotlib install issue on Windows 7 for freetype, png packages
Using Python 2.7 on Windows 7. Here is the command I am using to install and error message. Wondering if anyone have met with similar issues before? Thanks.
8 Answers 8
Get matplotlib from above location. Choose correct package based on python(2.x/3.x) and bit(32/64) version.
If you face any issues in the middle, please refer to below link: https://stackoverflow.com/a/38618044/5334188
As you can see it png and freetype modules are missing. You need to install them separately.
Try doing the following :
I solved it by taking version 1.5.1
it seems that version 1.5.2 installer is broken.
I had the exact same issue.
Seems that my pip was v7 which is old. upgraded to v9 with the ‘upgrade’ button. then tried to install matplotlib again and was successful this time.
maybe this helps
I came across the same problem with you, and here is my solution
It has the problem with python 3.6 integrated with the newest pip. so I installed python 3.5.2 with pip, but do not upgrade pip. And you can get matplotlib installed in this way.
Hope I could provide a possible solution
I solved the same problem in Wİndows 10 as folowing:
1- Download the following files for win32 or win64 python3.7:
2- By cmd console run the downloaded file under python:
I freshly installed python 3.10 and used it with PyCharm,I am on windows 10.
I installed the ‘numpy’ package, and it went fine.
I tried to install the ‘matplotlib’ but I got an error message:
ERROR: Command errored out with exit status 1: 'C:\Users\MEDVX\PycharmProjects\pythonProject\venv\Scripts\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\MEDVX\\AppData\\Local\\Temp\\pip-install-un3kpywl\\matplotlib_14231889845d46839010c545a31f9693\\setup.py'"'"'; __file__='"'"'C:\\Users\\MEDVX\\AppData\\Local\\Temp\\pip-install-un3kpywl\\matplotlib_14231889845d46839010c545a31f9693\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\MEDVX\AppData\Local\Temp\pip-record-v8ijdjvm\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Users\MEDVX\PycharmProjects\pythonProject\venv\include\site\python3.10\matplotlib' Check the logs for full command output.
After that, I tried to update my pip, it updated to version latest version, but the error remained.
It says to `»Try to run this command from the system terminal. Make sure that you use the correct version of ‘pip’ installed for your Python interpreter located at:
'C:\Users\MEDVX\PycharmProjects\pythonProject\venv\Scripts\python.exe'."`
but when I try to install/update in this directory it writes:
C:\Users\MEDVX\AppData\Local\Programs\Python\Python310\python.exe: can't open file 'C:\\Users \\MEDVX\\pip': [Errno 2] No such file or directory
I tried diffrent commands to check the pip version, or to install it but all of them return the same error, seen above.
I’d say that I am a tech noob and maybe the problem is that I am doing something dumb and obvious, I suspect I need to install it to another directory but I can’t figure out which, or maybe it has to do with my PyCharm settings ?
I would appreciate all the help.
[Pycharm error][1]
[Updating my pip][2]
[error after updating the path pycharm told me][3]
EDIT:
I managed to install matplotlib by installing «matplotlib «Microsoft C++ Build Tools».
But, I am unable to install pyplot, same issue, even after updating my pip inside PyCharm it shows an error:
ERROR: Could not find a version that satisfies the requirement pyplot (from versions: none)
ERROR: No matching distribution found for pyplot