[英]Python PIP install package errors
I am completely new to Python programming.我对 Python 编程完全陌生。 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.据我了解,如果我想安装任何 python 软件包,我需要使用pip install
,但下载一些软件包时似乎有很多麻烦。
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".我用不同类型的包遇到过这个问题几次,起初我喜欢下载numpy
但轮子文件似乎有问题,但最终我从“非官方 Windows 二进制文件 ZA7F5F35426B9274211FC923”下载了轮子文件。
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.现在我要再次下载另一个包“RPI.GPIO” ,下面是我在命令提示符中遇到的错误,我认为这与我在安装numpy
时遇到的问题类似。
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.我试图在“Unofficial Windows Binaries for Python Extension Packages”上搜索包,但我找不到它,我认为它不是常见的 ZEFE90A8E604A7C840E88ZD03A67F6B7D。
Can anyone help me with this?谁能帮我这个? and maybe give me a short explanation on how pip install
works?也许给我一个关于pip install
如何工作的简短解释? Thanks in advance.提前致谢。
The reason that you cannot install RPI.GPIO
is that it is a module for Raspberry Pi.无法安装RPI.GPIO
的原因是它是 Raspberry Pi 的模块。 To install numpy
, I would suggest trying要安装numpy
,我建议尝试
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.这样您就可以使用 Python 3. 如果这仍然不起作用,下载和安装 Anaconda 将很有用。 After you make sure you installed Anaconda correctly and check conda
is in path of your terminal, type在确保正确安装 Anaconda 并检查conda
是否在终端路径中后,键入
conda create -n [your_env_name] python=[desired_version] numpy
so that it will automatically build the dependencies for numpy
in your environment.这样它就会在您的环境中自动构建numpy
的依赖项。
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.为 RPI.GPIO 添加一个虚拟接口,以便在笔记本电脑上尝试代码,或在笔记本电脑上为 GPIO 编码。 It does nothing, it just a dummy interface but it will not prompt any error when debugging on other machine other than Raspi.它什么也不做,它只是一个虚拟接口,但在 Raspi 以外的其他机器上调试时不会提示任何错误。
Here is the reference: Create Fake RPI.GPIO这是参考:创建假 RPI.GPIO
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.