小编its*_*sy0的帖子

UnicodeDecodeError:“ charmap”编解码器无法解码位置X的字节0x9d:字符映射到<undefined>

当我尝试使用pip 安装StringGenerator时,系统出现以下错误提示:

C:\Users\Administrator> pip install StringGenerator

Collecting StringGenerator 
Using cached StringGenerator-0.3.0.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Users\ADMINI~1\AppData\Local\Temp\2\pip-build-mdvrj2cf\StringGenerator\setup.py", line 7, in <module>
    long_description = file.read()
  File "c:\users\administrator\appdata\local\programs\python\python36-32\lib\encodings\cp1252.py", line 23, in decode
    return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 1264: character maps to <undefined>

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\ADMINI~1\AppData\Local\Temp\2\pip-build-mdvrj2cf\StringGenerator\
Run Code Online (Sandbox Code Playgroud)

python windows pip

3
推荐指数
4
解决办法
7874
查看次数

使用socks5代理的Python请求

我已经部署了一个AWS ec2实例来使用代理。我已经编辑了安全策略并允许我的机器访问服务器。我使用端口 22 作为 SSH,使用端口 4444 作为代理。由于某种原因,我仍然无法使用代理启动会话。

代码:

import requests

session = requests.Session()
user_agent = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36'
headers = {'user-agent' : user_agent}
proxies = {
    'http' : 'socks5h://ec2-ip-address-here.us-east-2.compute.amazonaws.com:4444',
    'https' : 'socks5h://ec2-ip-address-here.us-east-2.compute.amazonaws.com:4444',
}

print(session.get('https://www.ipchicken.com/', headers=headers, proxies=proxies).content)
Run Code Online (Sandbox Code Playgroud)

错误:

requests.exceptions.ConnectionError: SOCKSHTTPSConnectionPool(host='www.ipchicken.com', port=443): Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3.contrib.socks.SOCKSHTTPSConnection object at 0x107a09048>: Failed to establish a new connection: [Errno 61] Connection refused'))
Run Code Online (Sandbox Code Playgroud)

我不确定我做错了什么。我按照此视频https://www.youtube.com/watch?v=HOL2eg0g0Ng来设置服务器。感谢所有提前回复的人。

python amazon-ec2 socks python-3.x python-requests

1
推荐指数
1
解决办法
5311
查看次数

标签 统计

python ×2

amazon-ec2 ×1

pip ×1

python-3.x ×1

python-requests ×1

socks ×1

windows ×1