Python 如何在 Ubuntu 上安装 Socks / SocksIPy?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14820453/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-18 12:32:10  来源:igfitidea点击:

How do I install Socks / SocksIPy on Ubuntu?

pythonubuntuinstallsocks

提问by user1868039

I am new to python and would like to install SocksIPyon Ubuntu (running within a VirtualBox vm). The README says to place the socks.pyfile into my lib/site-packagesdirectory. I do not know where to locate this directory. The Terminal command python socks.py installfrom the root runs, but does not install correctly (error "No module named socks" when I run import socksin a python script)

我是 python 新手,想安装SocksIPy在 Ubuntu 上(在 VirtualBox vm 中运行)。自述socks.py文件说将文件放入我的lib/site-packages目录中。我不知道在哪里可以找到这个目录。python socks.py install来自 root的终端命令 运行,但安装不正确(当我import socks在 python 脚本中运行时出现错误“No module named socks” )

SocksIPy link http://socksipy.sourceforge.net/

SocksIPy 链接 http://socksipy.sourceforge.net/

Can someone suggest a way to get socks/socksipy running on my machine? Thanks!

有人可以建议一种让socks/socksipy在我的机器上运行的方法吗?谢谢!

采纳答案by eldarerathis

The simplest way to install it - provided the VM has working Internect connectivity - would likely be to let apt-getdo it for you. From a terminal:

安装它的最简单方法 - 如果 VM 具有有效的 Internet 连接 - 可能是让apt-get您为您完成。从终端:

sudo apt-get install python-socksipy

It's in the universe repository, which should be enabled by default. If not, you can enable it yourself.

它位于 Universe 存储库中,默认情况下应启用该存储库。如果没有,您可以自己启用它

回答by jfs

PySocksis yet another SocksiPyfork:

PySocks是另一个SocksiPy叉子:

$ pip install PySocks

It works on Python 2/3.

它适用于 Python 2/3。

回答by Anshuman Kirty

For Python3

对于 Python3

$ sudo apt-get install python3-socks