.exeファイルで変換したい.pyファイルがあります。私はそれを変換するためにcx_Freezeを使用しました。しかし、私はそれを示して.exeファイルを実行しようとしている時にエラー -cx_Freezeを使用して.pyファイルを.exeファイルに変換中にエラーが発生する
H:\Python\Practice\Download Bollywood Song\build\exe.win32-3.5>cmd /K "download_bollywood_song.exe"
Traceback (most recent call last):
File "C:\Program Files\Anaconda3\lib\site-packages\requests\packages\__init__.py", line 27, in <module>
from . import urllib3
File "C:\Program Files\Anaconda3\lib\site-packages\requests\packages\urllib3\__init__.py", line 8, in <module>
from .connectionpool import (
File "C:\Program Files\Anaconda3\lib\site-packages\requests\packages\urllib3\connectionpool.py", line 28, in <module>
from .packages.six.moves.queue import LifoQueue, Empty, Full
File "C:\Program Files\Anaconda3\lib\site-packages\requests\packages\urllib3\packages\six.py", line 203, in load_module
mod = mod._resolve()
File "C:\Program Files\Anaconda3\lib\site-packages\requests\packages\urllib3\packages\six.py", line 115, in _resolve
return _import_module(self.mod)
File "C:\Program Files\Anaconda3\lib\site-packages\requests\packages\urllib3\packages\six.py", line 82, in _import_module
__import__(name)
ImportError: No module named 'queue'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Program Files\Anaconda3\lib\site-packages\cx_Freeze\initscripts\__startup__.py", line 12, in <module>
__import__(name + "__init__")
File "C:\Program Files\Anaconda3\lib\site-packages\cx_Freeze\initscripts\Console.py", line 24, in <module>
exec(code, m.__dict__)
File "download_bollywood_song.py", line 10, in <module>
File "C:\Program Files\Anaconda3\lib\site-packages\requests\__init__.py", line 63, in <module>
from . import utils
File "C:\Program Files\Anaconda3\lib\site-packages\requests\utils.py", line 24, in <module>
from ._internal_utils import to_native_string
File "C:\Program Files\Anaconda3\lib\site-packages\requests\_internal_utils.py", line 11, in <module>
from .compat import is_py2, builtin_str, str
File "C:\Program Files\Anaconda3\lib\site-packages\requests\compat.py", line 11, in <module>
from .packages import chardet
File "C:\Program Files\Anaconda3\lib\site-packages\requests\packages\__init__.py", line 29, in <module>
import urllib3
ImportError: No module named 'urllib3'
H:\Python\Practice\Download Bollywood Song\build\exe.win32-3.5>
次変換した後、私はpip install queue
コマンドを使用して、「キュー」モジュールをインストールしようとしました。 しかし、それは、この問題を解決するためにどのようにエラー -
Microsoft Windows [Version 6.1.7600]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Users\USER PC>pip install queue
Collecting queue
Could not find a version that satisfies the requirement queue (from versions:)
No matching distribution found for queue
C:\Users\USER PC>
次示し?? 私はWindows 7 32ビットでPython 3.5を使用しています。
EDIT ここは私のコードです.exeファイルに変換したいです。
import time;
import requests;
from bs4 import BeautifulSoup;
def get_page(url):
response = requests.get(url);
html = response.text;
return html;
def make_soup(html):
soup = BeautifulSoup(html,"html.parser");
return soup;
def get_movie_link(words):
movie_name = "";
first = True;
for word in words:
if(not first):
movie_name+=" ";
first = False;
movie_name+=word;
movie_link = "";
movie_name = movie_name.title();
first_character = movie_name[0];
url = "http://songsmp3.co/1/bollywood-music/list-" + first_character + ".html";
html = get_page(url);
soup = make_soup(html);
movie_list = soup.find_all("div",class_="list_inside_box");
movies = [];
for movie in movie_list:
movies = movie.find_all("a");
for movie in movies:
name = movie.get_text();
link = movie.get("href");
if(name.find(movie_name) > -1):
movie_link = link;
break;
return movie_name,movie_link;
def get_download_link(movie_name,movie_link):
if(movie_link == ""):
return movie_link;
if(movie_link.find("http://songsmp3.co") == -1):
movie_link = "http://songsmp3.co" + movie_link;
html = get_page(movie_link);
soup = make_soup(html);
links = soup.find_all("div",class_="link-item-zip");
download_link = "";
for link in links:
data = link.find("a");
song_link = data.get("href");
if(download_link == ""):
download_link = song_link;
return download_link;
def download_songs(movie_name,download_link):
if(download_link == ""):
return;
file_name = movie_name + ".zip";
response = requests.get(download_link, stream=True);
file = open(file_name, "wb");
file.write(response.content);
file.close();
return;
start_time = time.clock();
#print("N.B: Becareful about spelling.");
words = input().split();
movie_name,movie_link = get_movie_link(words);
download_link = get_download_link(movie_name,movie_link);
download_songs(movie_name,download_link);
end_time = time.clock();
print("Execution Time: %.2f"%(end_time-start_time));
そして、ここではそれが本当の問題は、ここであなたの実際のコードを貼り付けなくては何か言うのは難しいです
from cx_Freeze import setup, Executable;
setup(name="Download Bollywood Song",version="1.0.1",description="Download specified movie songs",
executables=[Executable("download_bollywood_song.py")]);
任意の解決方法?? : –