Python pip3 egg_info error code 1 while installing

2019-07-25 02:21发布

问题:

I have recently got python 3.6 and I am installing python packages. So far requests has worked but for pygame, I get an error:

 WARNING, No "Setup" File Exists, Running "config.py"
Using WINDOWS configuration...

Path for SDL not found.
Too bad that is a requirement! Hand-fix the "Setup"
Path for FONT not found.
Path for IMAGE not found.
Path for MIXER not found.
Path for PNG not found.
Path for JPEG not found.
Path for PORTMIDI not found.
Path for COPYLIB_tiff not found.
Path for COPYLIB_z not found.
Path for COPYLIB_vorbis not found.
Path for COPYLIB_ogg not found.

If you get compiler errors during install, doublecheck
the compiler flags in the "Setup" file.


Continuing With "setup.py"
Error with the "Setup" file,
perhaps make a clean copy from "Setup.in".
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Users\Nicholas\AppData\Local\Temp\pip-build-xufd58ed\pygame\setup.py", line 165, in <module>
    extensions = read_setup_file('Setup')
  File "c:\program files\python36\lib\distutils\extension.py", line 171, in read_setup_file
    line = expand_makefile_vars(line, vars)
  File "c:\program files\python36\lib\distutils\sysconfig.py", line 410, in expand_makefile_vars
    s = s[0:beg] + vars.get(m.group(1)) + s[end:]
TypeError: must be str, not NoneType

----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\Nicholas\AppData\Local\Temp\pip-build-xufd58ed\pygame\

I have had errors similar to this when installing other packages such as pandas Could the error be that the packages are not yet ready for python 3.6 or somthing else? I am running windows 10 64bit

Please help, Nic

回答1:

I had the same problem as you.

Setup

Go to this page: http://www.lfd.uci.edu/~gohlke/pythonlibs/#pygame and download the .whl file that suits your Python and Windows version.

In my case it's pygame‑1.9.2‑cp36‑cp36m‑win_amd64.whl since I use Python 3.6.0 and Windows 64-bit.

Next, enter cmd in the search box on your taskbar and press enter. A command window will open.

Enter the following into the cmd:

pip install setuptools
pip install wheel
pip install --upgrade setuptools
pip install --upgrade wheel

You then have two options when installing pygame:

Option 1 - In Python Folder

Paste the file you downloaded earlier in the Python folder (in my case it's C:\Python).

If you downloaded pygame‑1.9.2‑cp36‑cp36m‑win_amd64.whl, install pygame with:

pip install pygame‑1.9.2‑cp36‑cp36m‑win_amd64.whl

(Or else change pygame‑1.9.2‑cp36‑cp36m‑win_amd64.whl to the name of the file you downloaded, if it is different to mine).

Before you enter the previous command, make sure the file you downloaded is in the Python folder (in my case, C:\Python\pygame‑1.9.2‑cp36‑cp36m‑win_amd64.whl) and you copied the whole file name including the .whl extension or else it won't work.

Option 2 - On Desktop

Paste the file you downloaded earlier on your desktop.

If you placed your .whl file on your desktop, enter this to change your current directory:

cd "C:\Users\(your_username)\Desktop"

Then, if you downloaded pygame‑1.9.2‑cp36‑cp36m‑win_amd64.whl, install pygame with:

pip install pygame‑1.9.2‑cp36‑cp36m‑win_amd64.whl

(Or else change pygame‑1.9.2‑cp36‑cp36m‑win_amd64.whl to the name of the file you downloaded, if it is different to mine).

Before you enter the previous command, make sure you change your current directory and you copied the whole file name including the .whl extension or else it won't work

This should install pygame 1.9.2 and work on Python 3.6.0.