Bou*_*zza 3 sublimetext3 package-control sublime-text-plugin
我有一个问题,当我安装sublime文本3的包控件因为代理集但我需要安装一个插件所以任何人都可以帮助我吗?当我在控制台中执行getproxy时它返回我{}当我尝试在控制台中使用python设置代理时
urllib.set_proxy(' http:// user:password @ server:port ','http')
我用他们的值替换了用户,密码,服务器和端口,但它返回了我
raceback (most recent call last):
File "<string>", line 1, in <module>
AttributeError: 'module' object has no attribute 'set_proxy'
Run Code Online (Sandbox Code Playgroud)
我该怎么做才能使它有效?我需要安装一个插件
mat*_*tst 10
您需要在设置中设置代理服务器Package Control.
将下面的代码复制并粘贴到一个Package Control.sublime-settings必须保存在User配置文件夹中的文件中.该文件夹与保存USER Preferences.sublime-settings文件的文件夹相同.数据目录说明了操作系统中的位置.即
%APPDATA%\Sublime Text 3\Packages\User\Package Control.sublime-settings~/Library/Application Support/Sublime Text 3/Packages/User/Package Control.sublime-settings~/.config/sublime-text-3/Packages/User/Package Control.sublime-settings显然,您必须在下面的相关字段中添加域和端口以及您的用户名和密码.代理应采用以下形式:proxyserver:port.例如
{
"http_proxy": "server.com:80",
"https_proxy": "server.com:8080",
"proxy_username": "mynameis",
"proxy_password": "mypassis",
}
Run Code Online (Sandbox Code Playgroud)
另请参阅:包控制设置
{
// An HTTP proxy server to use for requests. Not normally used on Windows
// since the system proxy configuration is utilized via WinINet. However,
// if WinINet is not working properly, this will be used by the Urllib
// downloader, which acts as a fallback.
"http_proxy": "",
// An HTTPS proxy server to use for requests - this will inherit from
// http_proxy if it is set to "" or null and http_proxy has a value. You
// can set this to false to prevent inheriting from http_proxy. Not
// normally used on Windows since the system proxy configuration is
// utilized via WinINet. However, if WinINet is not working properly, this
// will be used by the Urllib downloader, which acts as a fallback.
"https_proxy": "",
// Username and password for both http_proxy and https_proxy. May be used
// with WinINet to set credentials for system-level proxy config.
"proxy_username": "",
"proxy_password": "",
}
Run Code Online (Sandbox Code Playgroud)
您只需在Sublime 3控制台(使用CTRL+` 或启动控制台View -> Show Console)中运行以下命令即可。
import urllib.request,os; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler({'http': 'http://USER:PASSWORD@HOST:PORT', 'https': 'https://USER:PASSWORD@HOST:PORT'})) ); open(os.path.join(ipp, pf), 'wb').write(urllib.request.urlopen( 'http://sublime.wbond.net/' + pf.replace(' ','%20')).read())
Run Code Online (Sandbox Code Playgroud)
在上面的代码,你需要更换价值(USER:PASSWORD@HOST:PORT中)http和https键按您的代理详细信息
然后点击Enter,它将Package Control使用提供的代理安装
| 归档时间: |
|
| 查看次数: |
9906 次 |
| 最近记录: |