I've created a deployment script of the embeddable release of Python3 being used portable (understand without the need of installation on windows machines without administrative rights). The python this way is barebone. It has no modules. (see the method I used here)
Now we come to the problem at hand. I cannot figure out a way to install tkinter.
Different suggestions like python -m install tk or tkinter, python-tk, python3-tk, etc all fail. Actually tk installs some module that has nothing to do with tkinter.
I tried pulling out the tk installation from the official python installation still fail.
Does anyone have idea how could this be done?
Related
I have an issue that has been discussed in some GitHub blogs but the answers there are so confusing and complex that I thought to ask here as well.
Before asking, let me just say I'm not an expert programmer, so my apologizes if mine is a simple question.
I recently had to install Python 3.7
I used to have modules like clr and System working totally fine and now everything seems broker.
I use Anaconda/Spyder to simply load the packages clr and System and Python gives me the following error messages:
No module named 'clr'
No module named 'System'
I managed to fix (apparently) the clr issue by running
pip install clr
from Anaconda Prompt.
However, in order to fix the issue with the System module, it seems I need to install pythonnet (I don't knoww exactly what it is but I guess it doesn't matter).
Based on anaconda official website: https://anaconda.org/pythonnet/pythonnet I should simply run:
conda install -c pythonnet pythonnet
But that doesn't work.
My extremely limited understanding is that something is going wrong between Pythonnet and Python 3.7.
Does anybody have a clue of what I should do?
you must uninstall first clr and then do pip install pythonnet. pythonnet has clr and System.
check documentation: https://github.com/pythonnet/pythonnet
you should use this:
import clr
clr.AddReference('System')
from System import String
What eventually worked for me, after messing around with my packages, was to: 1. uninstall clr. 2. Uninstall pythonnet. 3. Only at this point, I had to reinstall pythonnet. This sequence fixed my problem.
pip uninstall clr
pip uninstall pythonnet
pip install pythonnet
In my Python3, System is not a module - it's a method of the os module.
so I use
from os import system
then
system("<<Put Your Command Here>>")
If you want it called System with a capital S (maybe for backward compatability with already-written programs?), use
from os import system as System
How can I make my GTK3+ Python script work outside of Msys2's own Python interpreter, into my own venv (virtual environment) Python3 interpreter? I want to prepare my Python 3 script for distribution to other computers, but without Msys2.
I'm using Windows 10.
I've successfully followed the instructions on GTK's website, to download GTK3+ and the Python bindings, in Windows.
I've installed GTK3+ and the Python bindings using MSYS2. My script runs successfully within MSYS2's Python3 interpreter in C:\msys64\mingw64\bin. However, I want to run my Python script outside of MSYS2, with a separate Python 3 interpreter (venv) - not the one in MSYS2.
From my research, it seems that I need to copy the GTK3 .dll files and icons from
C:\msys64\mingw64\bin
and C:\msys64\mingw64\share
to the Python3 interpreter path that I want, with my script files in there too.
But when I attempt to run my script in the virtual environment, I get:
builtins.ImportError: cannot import name '_gi' from 'gi'
Any ideas? Thanks.
I don't know if that is possible.
But if the final intent is to distribute your app, then you should install PyInstaller inside MSYS2 and generate an executable there. Then you'll be able to distribute and execute your app on any Windows machine.
It will only be possible to run your program using the MSYS2 Python interpreter and with all of the required libraries. You can't just copy files and then run them with the Windows Python interpreter that was built using MSVC.
PyInstaller is a good solution to package an app with the interpreter and all of the libraries. The issue you mentioned about getting errors about no module named '_struct' has been fixed.
I have many python 3.5 scripts to handle my business affairs. All of these run perfect from IDLE and from the bash shell. When I create OSX Automator apps they all run well except the included reportlab functions do not work. I have also attempted to create the app with py2app but this fails to find the qt4 and reportlab libraries and fails. Any suggestions?
I can say I am quite new to the world of Python but not to programming. I have been using PyCharm over the last year and I got Python conda distribution to make my life easier with package management.
Lately, I have been trying to play with a package known PuLP which was not available to download via conda but I installed using pip. I realized that although PyCharm recognizes pulp when running my code, it is not in the available packages and I am not sure that the same version of PuLP is used in and out of PyCharm. Specifically, when I run the pulpTestAll command that looks for installed solvers from my terminal, the recognized solvers are different than those recognized when I run exactly the same script within PyCharm.
Can someone give me a tip on how to fix this?
How do I import modules in pycharm?
You may look here. Maybe you have to specify an interpreter for the Conda environment. To do that when you are choosing an interpreter at the right there is a gear at the right. After you press it, you may add a new interpreter and you can choose Conda Environment.
I'm trying to install Pygame and it returns me the following error "Python version 3.4 required which was not found in the registry". However I already have the Python 3.4.1 installed on my system. Does anyone know how to solve that problem?
I've been using Windows 8.1
Thanks in advance.
Are you using a 64-bit operating system? Try using the 32-bit installer.
Tips I can provide:
Add Python to your Path file in the Advanced settings of your Environmental Variables (just search for it in the control panel)
Something may have gone wrong with the download of Python, so re-install it. Also don't download the 64-bit version, just download the 32-bit version from the main pygame website
Once that's sorted out, transfer the entire Pygame file to the site packages in the Python directory and open up the pygame file and go to this directory in command prompt. Finally, run the Pygame setup from the command prompt which should be something like:
python setup.py
But this will only work if the pygame setup file is called setup.py (it's been a while since I downloaded it), you added Python to the Path file and you're currently in the correct directory in command prompt.
To test if it worked try importing pygame and see if you got an error or not.