我为尝试cx制作了2个python程序 _冻结 第一个程序(名称:example.py):
import urllib.request
import urllib.parse
import re
url = 'https://en.wikipedia.org/wiki/Aura_Kingdom'
values = {'s':'basics',
'submit':'search'}
data = urllib.parse.urlencode(values)
data = data.encode('utf-8')
req = urllib.request.Request(url, data)
resp = urllib.request.urlopen(req)
respData = resp.read()
paragraphs = re.findall(r'<p>(.*?)</p>',str(respData))
for eachP in paragraphs:
print(eachP)
第二个程序(名称:setup.py):
from cx_Freeze import setup, Executable
setup(anme = 'urlparse',
version='0.1',
description='Parse stuff',
executable = [Executable("distme.py")])
成功安装了cx_freeze。尝试使用命令py setup.py build来构建setup.py它给出错误:在第1行导入urllib.request ImportError:没有名为request.tried的模块使用pip安装请求安装请求模块但是它给出了错误:命令&#34; python setup.py egg_info&#34;在C:\ user \ jalaj \ AppData \ Local \ Temp \ pip-build-e7xz36j3 \ request
中失败,错误代码为1