简体   繁体   English

在Arch Linux中安装urllib2

[英]Install urllib2 in Arch Linux

I am trying to install the urllib2 module in Arch Linux as I need to run a Python code. 我想在Arch Linux中安装urllib2模块,因为我需要运行Python代码。

The error that the Python code outpus is: Python代码输出错误是:

File "PiMiner/PiMiner.py", line 3, in <module>
import sys, subprocess, time, urllib2, socket

Now, when I runt his code sudo pacman -S urllib2 , I get error: target not found: urllib2 现在,当我运行他的代码sudo pacman -S urllib2error: target not found: urllib2

What can I do in this situation? 在这种情况下我该怎么办?

In ArchLinux, the command python defaults to python3 . 在ArchLinux中,命令python默认为python3 If you neeed to use 2.x, you should run the script with python2 whatever.py . 如果需要使用2.x,则应使用python2 whatever.py运行脚本。

As aelfric5578 said, python defaults to python3 正如aelfric5578所说, python默认为python3

But if you wish to run it with python3 then you can search the Arch repos with pacman -Ss urllib which will a return a list of packages you can pacman -S 但是,如果您希望使用python3运行它,则可以使用pacman -Ss urllib搜索Arch pacman -Ss urllib ,这将返回一个列表,您可以pacman -S

As a naming scheme, Arch sticks to python-libname for python 3 or python2-libname for python2, so it's usually a safe bet to pacman -S python-missinglib 作为命名方案,Arch坚持使用python-libname 3的python-libnamepython2-libname ,因此通常对pacman -S python-missinglib是一个安全的选择

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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