I'm converting my python 3.5 program to an exe file using pyinstaller ,here's my environment:
system:windows 10
python:python 3.5,exactly i installed Anaconda3-4.2.0-Windows-x86_64.exe
pyinstaller:3.2
I have already copy myfile.py in pyinstall file
then i run in cmd:
cd C:\Program Files\Anaconda3\Scripts
pyinstaller.exe -F myfile.py
The code runs successfuly,and I got 2 folder
C:\Program Files\Anaconda3\Scripts\build
C:\Program Files\Anaconda3\Scripts\dist
In "C:\Program Files\Anaconda3\Scripts\dist" , I got a myfile.exe , bug when I run it , the error occured:
Traceback (most recent call last):
File "site-packages\PyInstaller\loader\rthooks\pyi_rth_pkgres.py", line 11, in <module>
File "c:\program files\anaconda3\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 389, in load_module
exec(bytecode, module.__dict__)
File "site-packages\setuptools-27.2.0-py3.5.egg\pkg_resources\__init__.py", line 68, in <module>
File "site-packages\setuptools-27.2.0-py3.5.egg\pkg_resources\extern\__init__.py", line 61, in load_module
ImportError: The 'appdirs' package is required; normally this is bundled with this package so if you get this warning, consult the packager of your distribution.
Failed to execute script pyi_rth_pkgres
I checked the logs in C:\Program Files\Anaconda3\Scripts\build\myfile\warnout.txt , then got warns like this:
missing module named PyQt5.QtCore.QCoreApplication - imported by PyQt5.QtCore, c:\program files\anaconda3\lib\site-packages\PyInstaller\loader\rthooks\pyi_rth_qt5plugins.py
missing module named PyQt5.QtCore.QIODevice - imported by PyQt5.QtCore
missing module named PyQt5.QtCore.QBuffer - imported by PyQt5.QtCore
missing module named PyQt5.QtGui.QPixmap - imported by PyQt5.QtGui
missing module named PyQt5.QtGui.QImage - imported by PyQt5.QtGui
missing module named PyQt5.QtGui.qRgba - imported by PyQt5.QtGui
missing module named 'PyQt5.sip' - imported by c:\program files\anaconda3\lib\site-packages\PyInstaller\loader\rthooks\pyi_rth_qt5plugins.py
missing module named numpy.infty - imported by numpy, scipy.sparse.linalg.isolve.lsmr
missing module named numpy.finfo - imported by numpy, scipy.sparse.linalg.isolve.minres, scipy.optimize.slsqp, scipy.optimize.minpack, scipy.optimize.zeros
missing module named numpy.inner - imported by numpy, scipy.sparse.linalg.isolve.minres
missing module named pandas.core.base.NoNewAttributesMixin - imported by pandas.core.base, pandas.core.strings, pandas.tseries.common, pandas.core.categorical
missing module named pandas.core.base.PandasDelegate - imported by pandas.core.base, pandas.tseries.common, pandas.core.categorical
missing module named pandas.core.base.AccessorProperty - imported by pandas.core.base, pandas.core.strings
There's many warns like this , I also tried some similar codes like:
pyinstaller.exe -F "myfile.py"
pyinstaller.exe --onefile "myfile.py"
pyinstaller.exe -F -p C:\Program Files\Anaconda3\Lib\site-packages\pandas myfile.py #(-p options like this)
But I got the same result also(no error occured,but warns happened,and the exe file can't use)
How can I do ? Thanks!
I just have solved it , just do like this:
first install pyinstaller
pip install pyinstaller
because if install pyinstaller with pyinstaller.exe , you may short of some dependents package . then
pip unistall pyinstaller
yes , you just do it .
then , download the pyinstaller developed version from
https://github.com/pyinstaller/pyinstaller
then , unpack the zip file , run cmd in the file,
python setup.py install
That's ok ......
Related
I used auto-py-to-exe to create an exe file.
When I execute my .exe file, I got this error:
Traceback (most recent call last): File "inventory_manager.py", line
7, in File "PyInstaller\loader\pyimod03_importers.py", line
495, in exec_module File "PyQt5_init_.py", line 20, in
ModuleNotFoundError: No module named 'pkgutil'
When I try to install this module with:
pip install pkgutil
I get this message:
ERROR: Could not find a version that satisfies the requirement pkgutil
(from versions: none) ERROR: No matching distribution found for
pkgutil
Does somebody know how to fix this?
Here is my setup: Python 3.9.12 64-bit | Qt 5.15.3 | PyQt5 5.15.4 | Windows 10
lately using 9.0.1, I have been using Project Interpreter to import modules for my files. I opened up a new project in PyCharm today to try and test 10.0.1. Using the Pip version of 10.0.1, I couldn't install packages into my file.
The command output was :
Traceback (most recent call last):
File "C:\Program Files\JetBrains\PyCharm Community Edition 2017.3.3\helpers\packaging_tool.py", line 192, in main
retcode = do_install(pkgs)
File "C:\Program Files\JetBrains\PyCharm Community Edition 2017.3.3\helpers\packaging_tool.py", line 109, in do_install
return pip.main(['install'] + pkgs)
AttributeError: module 'pip' has no attribute 'main'
I googled this and it said that installing modules through pip was now unsupported, especially for
pip._internal.main
After looking at this site : https://pip.pypa.io/en/latest/user_guide/#using-pip-from-your-program for a while, it says to use :
subprocess.check_call([sys.executable, '-m', 'pip', 'install', 'my_package'])
I tried executing it and command prompt said that subprocess.check_call is not an internal or external file.
i also tried executing the commands through Command Prompt and downgrading my pip to 9.0.1 but none of this worked. When I changed Pip to 9.0.1 in Command Prompt, it had no effect on PyCharm.
Can anyone help with trying to import modules into PyCharm because I am currently trying to make a webcrawler using modules beautifulsoup4 and it is not letting me import it.
I'm using python 3.6
Trying to make and exe from my .py file. but when I run python setup.py build
it give me an error
raise ImportError("No module named %r" % name)
ImportError: No module named 'idna'
My setup file is like this
setup file
Save:
# thanks to https://www.youtube.com/watch?v=GSoOwSqTSrs
from cx_Freeze import setup, Executable
setup(
name='KutsalAklinNerde?',
version='0.1', #Further information about its version
description='Parse stuff', #It's description
executables= [Executable("Example.py")])
as setup.py in the same directory of your Example.py (the .py you want to convert to .exe)
And then run >python setup.py build in that directory with command prompt.
I downloaded the libtidy.dll and libtidy.lib and put them in the corresponding folders of python27. Then I installed pytidylib for python.
But when I type
import tidylib
I got below error which indicates python can't find the module
File "<pyshell#0>", line 1, in <module>
import tidylib
File "C:\Python27\lib\site-packages\tidylib\__init__.py", line 69, in <module>
raise OSError("Could not libtidy using any of these names: %s" % (",".join(LIB_NAMES)))
OSError: Could not libtidy using any of these names: libtidy,libtidy.so,libtidy- 0.99.so.0,cygtidy-0-99-0,tidylib,libtidy.dylib,tidy
Anyone can help one this?
I downloaded the libtidy.dll and libtidy.lib and put them in the corresponding folders of python27
Don't do that. Use pip or easy_install to manage your packages.
Update Apparently your question is about how to install dlls on windows. Put them in any directory on the windows PATH.
Pytidylib requires tidy, which is not a python package. You have to install it yourself and make it accessable.
If using windows, just extract the tidy package somewhere and add its bin folder to windows' PATH.
Hello I am trying to install python-twitter and one of the dependencies HTTPLIB2 is giving me a lot of problems. I have searched the internet up and down but maybe I do not know what the right key words are. Here is the problem.
I am installing python-twitter. I install the requirements either by "pip install -r requirements.txt" or doing them one by one through for example "pip install httplib2". Then I run "python setup.py install". It's happy but then "python setup.py test" fails as followed with an error on import HTTPLIB2.
python setup.py test
running test
running egg_info
writing requirements to python_twitter.egg-info/requires.txt
writing python_twitter.egg-info/PKG-INFO
writing top-level names to python_twitter.egg-info/top_level.txt
writing dependency_links to python_twitter.egg-info/dependency_links.txt
reading manifest file 'python_twitter.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
no previously-included directories found matching '.DS_Store'
writing manifest file 'python_twitter.egg-info/SOURCES.txt'
running build_ext
Traceback (most recent call last):
File "setup.py", line 73, in <module>
Main()
File "setup.py", line 66, in Main
setuptools.setup(**METADATA)
File
....
<deleted these parts to save space>
module = __import__('.'.join(parts_copy))
File "/Users/ME/Downloads/python-twitter-1.0/twitter_test.py", line 30, in <module>
import twitter
File "/Users/ME/Downloads/python-twitter-1.0/twitter.py", line 65, in <module>
import oauth2 as oauth
File "/usr/local/lib/python2.7/site-packages/oauth2/__init__.py", line 32, in <module>
import httplib2
File "/usr/local/lib/python2.7/site-packages/httplib2/__init__.py", line 347
print('%s:' % h, end=' ', file=self._fp)
^
SyntaxError: invalid syntax
But I thought the print error was an incompatibility between python 2 and 3. Why am I getting this while I clearly have python 2.7 (I checked and uninstalled and reinstalled HTTPLIB2).
Thanks much for your help
i had a same issue. It seems to be python2.7 and 3.x version conflict issue and resolved by
python2.7 -m pip install -t lib/ -r requirements.txt
Just in case, this happens when you install httplib2 with a python3 version of pip and then execute it with python2.
This happens for example when creating manually an environment with:
pip install -t lib/ -r requirements
As it happens when creating an AppEngine standard environment vendor folder.
This happens because contrary to most of the libraries, httplib2 has completely different versions for python2 and python3.