I've got a small program named "taquin" and I want to add an icon to the executable file.
My icon file is a image file 32x32 pixels extracted from a windows dll.
This program is built by py2exe with this small code
from distutils.core import setup
import py2exe
setup(
options = {'py2exe': {'bundle_files': 1, 'compressed': True}},
windows = [
{
"script" : 'taquin.py',
"icon_ressources" : [(1, "taquin.ico")],
}
],
)
Could you help me please ? My operating system is Windows 10...
All the code is here : draft.ericberthomier.fr/taquin.zip
There is a program called auto-py-to-exe which creates an exe out of your program without requiring you to create a setup file. The interface is great and allows you to easily create and exe without creating a setup.py. This also allows you to package your app as a single exe, without any other files. Below is a screenshot:
You can install the program by typing into the command line:
python -m pip install auto-py-to-exe
You can run it by typing in:
auto-py-to-exe
To see more about auto-py-to-exe, please visit the PyPI page at https://pypi.org/project/auto-py-to-exe/.
I implemented one package with GUI based on Pyside2. This package has the following structure:
Repository
Function
GUI_class
Main_GUI.py
It means Main_GUI.py use some classes and function in GUI and Function folders. Now I want to create the executable version from it for windows 10. I tried Pyinstaller for this aim like the following comments:
(conda env)F:\Repository> Pyinstaller Main_GUI.py
But when I run the *.exe file in dist folder it gives me the following error:
ModuleNotFoundError: No module named 'pkg_resources.py2_warn'
Blockquote[15728] Failed to execute script pyi_rth_pkgre
Would you please help me how can I convert this python package to *.exe? Thank you in advance.
These are my version of my dependencies:
Python 3.6.10,
Pyinstaller 3.6,
Pyside2 5.13.2.
I am trying to do the following in Python 3.7.1 on Windows
import sqlite3
but I get the following error message
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "c:\programdata\anaconda3\lib\sqlite3\__init__.py", line 23, in <module>
from sqlite3.dbapi2 import *
File "c:\programdata\anaconda3\lib\sqlite3\dbapi2.py", line 27, in <module>
from _sqlite3 import *
ImportError: DLL load failed: The specified module could not be found.
I have searched for a solution to the problem for quite a while now to no avail. I have also successfully run pip install pysqlite3 on the Anaconda prompt, but the import still fails. What do?
I got this working on windows by downloading: the sqlite3 dll (find your system version)
And placing it into the folder: C:\Users\YOURUSER\Anaconda3\DLLs
(Depending on how you installed Anaconda, this may have to be placed into
the following folder: C:\ProgramData\Anaconda3\DLLs)
According to #alireza-taghdisian, you can locate the exact path of
your conda environments (where you need to copy the sqlite3 dll) by typing:
conda info --envs on your anaconda prompt.
Locate the sqlite3.dll file. In my case it was in following folder
C:\Users\Admin\anaconda3\Library\bin
where C:\Users\Admin\anaconda3 is the folder where Anaconda was installed
Add this to PATH in environment variables, and it should work then.
Try copying the sqlite3.dll from the
C:\Users\YOURUSER\anaconda3\Library\bin
folder to
C:\Users\YOURUSER\Anaconda3\DLLs
Please check https://github.com/jupyter/notebook/issues/4332
I added anaconda root/Library/bin to my PATH and now it works!
Add CONDA_DLL_SEARCH_MODIFICATION_ENABLE=1 to your environment variables.
before executing the program, enter conda activate in your shell.
I had tried all above solutions But for me and my system I got to know that
I downloaded Python in C:\Python27 hence there is dll folder in python C:\Python27\DLLs
I installed Sqlite3.dll in my above dll folder
May be this solution will help you because it completely depends on where do you install your python
Happy coding :)
I put the sqlite3.dll in the path folder of my Python venv and still wont work. I suspected it is a path problem.
(In my case: E:\Virtual_Env\mini_zinc\env\Scripts)
I found in my case I messed up installation in a virtual evn, somehow using an anaconda python kernel within a Python venv.
I reinstall the Python Venv and check the python version after installed Env is correct (not the Anaconda python), then proceed with Jupyter Notebook (or Juyterlab) and works fine.
I was able to resolve this issue by putting sqlite3.dll file in the C:\Users<USERID>\AppData\Local\conda\conda\envs<ENV NAME>\DLLs.
Download sqlite3.dll file from https://www.sqlite.org/download.html
or copy it from C:\ProgramData\Anaconda3\DLLs\
I found the #elgsantos useful. But for those who are new to Python and Conda like me, I would like to add a little bit of details.
1- I use miniconda3 for creating new environment.
2- interestingly, I got two installation path on my computer for conda: the first one (the obvious) is located on "C:\Users\taghdisian\miniconda3". The second one is on "C:\Users\taghdisian\AppData\Local\r-miniconda". The latter is the primary path that you need to copy your sqlite3 files into the envs folder. I copy them in the "C:\Users\taghdisian\AppData\Local\r-miniconda\envs\sdr3.9\DLLs" in which the sdr3.9 is one of my virtual Condo environment.
you can locate the exact path of your conda environments (where you need to copy sqlite3) by typing the conda info --envs on your anaconda prompt.
I hope this help.
got the same error while loading the jupyter notebook from other conda prompt than "base" environment.
[1]: https://i.stack.imgur.com/2DW7E.png
Resolved by installing sqlite package
(nlpenv) C:\Users\arunk>conda install sqlite
launching
*
(nlpenv) C:\Users\arunk>jupyter notebook
I am using Ubuntu 18.10(dual Boot win10), I have installed anaconda (conda version- 4.6.7) on ubuntu. After this Installation I installed Pycharm via snap on Command Prompt. Since Pycharm(version - 2018.3.5) didnt Detect my python Location automatically I set the python Interpreter via
Adding Location ->System Interpreter (As I didn't want any Venv) -> Path
But when I try to import opencv in Pycharm it says
ModuleNotFoundError: No module named 'cv2'
Python3.6 in Anaconda Bin is shown to which I have linked in Pycharm (I have also tried other Python files there as well but no luck)
When I run in Terminal: python3 -c 'import sys; print(sys.path)'
It shows:
['', '/usr/lib/python36.zip', '/usr/lib/python3.6', '/usr/lib/python3.6
/lib-dynload', '/usr/local/lib/python3.6/dist-packages', '/usr/local
/lib/python3.6/dist-packages/setuptools-39.1.0-py3.6.egg', '/usr/lib`/python3
/dist-packages']
So could anyone help me out in this?? Thank You in Advance!!
Edit 1:
I am also unable to access any of the libraries from terminal Itself. So Could anyone help me with that as well. Should I export path of this Python in Anaconda bin folder to bashrc file in Ubuntu?
Edit 2:
The libraries affected is not just opencv. There are few other Libraries like Portaudio which are affected as well along with Opencv
I am running Python 3.6 in a venv on 64 bit Windows 10 inside PyCharm. Here are the steps I performed:
Open PyCharm and start a new project using Python 3.6 as the venv.
Downloaded the PythonMagick from a wheel file for Python3.6 from this source:PythonMagick wheel file
Open the terminal in PyCharm and run:
pip install PythonMagick-0.9.19-cp36-cp36m-win_amd64.whl
Download ghostscript from here: Ghostscript 9.25 for Windows (64 bit) and run the exe file.
Add the ghostscript directory C:\Program Files\gs\gs9.25\bin to the user PATH environment variable.
Now I run the sample file from here
import PythonMagick
if __name__ == "__main__":
pdf = 'a.pdf'
p = PythonMagick.Image()
p.read(pdf)
p.write('doc.jpg')
I get the following error:
RuntimeError: Magick: UnableToOpenConfigureFile `delegates.xml' #
warning/configure.c/GetConfigureOptions/714
How do I fix this error?
When installing PythonMagick in a VENV, apparently you need to also add a system variable called MAGICK_HOME so that Magick can find the config files.
Add the following to the User Variable
MAGICK_HOME = %your-project-dir%\venv\Lib\site-packages\PythonMagick
Then restart PyCharm.