Solution to pip problem after installing python2 and 3 versions on WINDOWS

Y2J
Release: 2017-05-05 16:03:26
Original
2449 people have browsed it

This article mainly shares with you the solution to the pip error after installing python2 and python3 at the same time under WINDOWS. It is very practical. Friends in need can refer to it

After installing python at the same time before Just change the environment variable PATH to

PATH=C:\Python36-32\scripts\;C:\Python36-32\;C:\Python27\;C:\Python27\scripts
Copy after login

and then modify the file after python3 installation as follows:

C:\Python36-32\scripts\pip.exe to C:\Python36-32\scripts\pip3.exe

C:\Python36-32\python.exe changed to C:\Python36-32\python3.exe

C:\Python36-32\pythonw.exe is changed to C:\Python36-32\pythonw3.exe

In this way, you can use python directly under the CMD command line python3 pip pip3 and other commands

Because I recently reinstalled the system and installed the latest versions of python2 and python3, python 2.7.13 and python 3.6.0

Follow the above method to fix this, python pip python3 command It works fine, but the following error is displayed when pip3 is executed:

Fatal error in launcher: Unable to create process using '"'

Obviously the process was not found when creating the process Related filesAh. Think of a way.

I found that there are files with the same icon and the same number of KB in the C:\Python36-32\scripts directory, and the functions they call are different. Several same exe files:

easy_instal3l.exe

easy_install-3.6.exe

pip.exe

I guess these EXE files based on experience In fact, it is the same EXE file with different resources or additional resources in the Debugging cracking field to execute different python scripts. Opening it with 7z confirmed my guess

Go to google first I searched for the source code of the pip exe for a while, but couldn't find it, so I just used IDA PRO F5. The general logic of this EXE is to find the last number of bytes of the EXE and a string that starts with a special symbol split And create the process with additional parameters and execute it. Use HEX

editor

to open pip.exe. Turn to the last part

## to see the red circle. When looking up the part, I found that the path was written hard. It should be the string attached when python was installed. OK, just change Solution to pip problem after installing python2 and 3 versions on WINDOWS

c:\python36-32\python.exe to c:\ python36-32\python3.exe Save.

Then copy C:\Python36-32\python3.exe and change it to C:\Python36-32\pytho3.exe

You read that right, the n was removed, because the original string python .exe has 10 characters. When modifying EXE, we usually need to ensure the length and position of the string in order to work properly and avoid errors such as data offset. To be lazy, I directly changed it to python3.exe like this can work fine.

The next step is to find the code and installation program of this pip.exe "shell". What is the purpose of attaching this resource? See if you can fix a bug and turn it into the upper-level path that automatically obtains the current exe path. The location of python3.

【Related recommendations】

1.

Python Free Video Tutorial


2.

Python Learning Manual

3.

Python object-oriented video tutorial

The above is the detailed content of Solution to pip problem after installing python2 and 3 versions on WINDOWS. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!