简体   繁体   中英

Python PIP install package errors

I am completely new to Python programming. As what I understand, if I want to install any python packages I need to use pip install but seems like there are many troubles for me when downloading some packages.

I met this problem a few times with different kind of packages, at first I like to download the numpy but it seems like something wrong with the wheel file but eventually I download that wheel file from "Unofficial Windows Binaries for Python Extension Packages".

Now again I am going to download another packages which is "RPI.GPIO" , and below is the error I face in the command prompt which I think is similar like the problem I met from the numpy installation.

picture 1

picture 2

I tried to search the packages on "Unofficial Windows Binaries for Python Extension Packages", but I can't find it I think it is not a common package.

Can anyone help me with this? and maybe give me a short explanation on how pip install works? Thanks in advance.

The reason that you cannot install RPI.GPIO is that it is a module for Raspberry Pi. To install numpy , I would suggest trying

pip3 install --upgrade pip
pip3 install --upgrade setuptools     
pip3 install numpy

so that you will work with Python 3. If this still does not work, downloading and installing Anaconda will be useful. After you make sure you installed Anaconda correctly and check conda is in path of your terminal, type

conda create -n [your_env_name] python=[desired_version] numpy

so that it will automatically build the dependencies for numpy in your environment.

An example is

conda create -n new_env python=3.7 numpy

Add a dummy interface for RPI.GPIO, in order to try the code on laptop, or coding on laptop for GPIO. It does nothing, it just a dummy interface but it will not prompt any error when debugging on other machine other than Raspi.

Here is the reference: Create Fake RPI.GPIO

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM