I'm forced to upgrade to Python 2.6 and am having issues using Numerical Python (NumPy) with Python 2.6 in Windows. I'm getting the following error...
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
from numpy.core.numeric import array,dot,all
File "C:\svn\svn_urbansim\UrbanSimDev\Builds\working\urbansim\Tools\Python26\lib\site-packages\numpy\__init__.py", line 39, in <module>
import core
File "C:\svn\svn_urbansim\UrbanSimDev\Builds\working\urbansim\Tools\Python26\lib\site-packages\numpy\core\__init__.py", line 5, in <module>
import multiarray
ImportError: Module use of python25.dll conflicts with this version of Python.
It appears that the existing module is trying to use the python25.dll file. Is there any way I can tell it to use the python26.dll file instead without modifying the source code?
How did you install it? NumPy doesn't currently have a Python 2.6 binary.
If you have LAPACK/ATLAS/BLAS, etc. and a development environment you should be able to compile numpy from sources. Otherwise I think you're stuck with using Python 2.5 on Windows if you need NumPy.
The next version of NumPy should have a 2.6 binary, and it's likely to be out within the next month or so.
[Edit]: It appears that a pygame developer created a NumPy 1.2.1 binary for Python 2.6 on Windows, available here.
NumPy 1.3.0 is available for Python 2.6 now.
Related
When I run some commands, which work, for example neofetch, it gives me a Python error.
username#host:~$ as
Traceback (most recent call last):
File "/usr/lib/command-not-found", line 28, in <module>
from CommandNotFound import CommandNotFound
File "/usr/lib/python3/dist-packages/CommandNotFound/CommandNotFound.py", line 19, in <module>
from CommandNotFound.db.db import SqliteDatabase
File "/usr/lib/python3/dist-packages/CommandNotFound/db/db.py", line 5, in <module>
import apt_pkg
ModuleNotFoundError: No module named 'apt_pkg'
It does that whenever I type an invalid command. This started happening after I installed Python 3.9. I am running Kubuntu with Python 3.10 installed by default.
Modern Linux distributions tend to use a lot of python scripts for internal use; for this reason python gets installed with a plethora of libraries.
The error you are getting is because you replaced that fairly complete system python with a version of your own choosing without providing all the libraries the original came with.
The error you see is emitted by /usr/lib/command-not-found, a script using python3 as found in the system path.
I strongly recommend that you re-install the original python packages and use e.g. anaconda for your specific python needs.
The main takeaway from this is:
DON'T MESS WITH THE SYSTEM PYTHON.
try to find which python are you using using which python and uninstall the first python interpreter it finds.
Short version: Python 3 is unable to use tkinter on my iMac.
Details and useful info: I'm on macOS Mojave, Version 10.14.3 (18D109). (I can't upgrade for a while yet because of software that won't run on the newer versions.)
In my scripts I'm using #!/usr/bin/env python3 and when I get to the line import tk as tkinter I get this error:
Traceback (most recent call last):
File "/Users/hal/Documents/Dev/HalPy/TestScript.py", line 5, in <module>
import tkinter
File "/Users/hal/.pyenv/versions/3.7.3/lib/python3.7/tkinter/__init__.py", line 36, in <module>
import _tkinter # If this fails your Python may not be configured for Tk
ModuleNotFoundError: No module named '_tkinter'
When I tested it, from the command line, I typed python and got the Python shell and the version info (Python 3.7.3 (default, Apr 11 2020, 02:53:05)). Then I tried import tkinter as tk and I get this:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/hal/.pyenv/versions/3.7.3/lib/python3.7/tkinter/__init__.py", line 36, in <module>
import _tkinter # If this fails your Python may not be configured for Tk
ModuleNotFoundError: No module named '_tkinter'
I see the module when I drop into the Help mode and type modules and tkinter shows up in the list of modules. Just in case, I tried installing it with pip, but it wouldn't install (which is what I expected).
So what do I need to do to get Python 3 to recognize tkinter? (Just in case it matters, Python 2 with Tkinter does work.)
Also, I have looked at this question and this one and this is NOT a duplicate. (First note that neither has an accepted answer.) The first one involves reinstalling, and the focus seems to be on Windows, and this is on macOS, which includes it pre-installed. I'm a bit concerned what reinstalling it would do. The 2nd question is having problems because it's being run within the XCode framework and one element of the issue is the wrong shebang and I'm already using the one the answer suggests.
you can find your answer here:
https://blog.lanzani.nl/2020/install-tkinter-macos/
If you are using a Python from any current python.org Python installer for macOS (3.9.0+, 3.8.0+, or 3.7.2+), no further action is needed to use IDLE or tkinter. A built-in version of Tcl/Tk 8.6 will be used.
If you are using macOS 10.6 or later, the Apple-supplied Tcl/Tk 8.5 has serious bugs that can cause application crashes. If you wish to use IDLE or Tkinter, do not use the Apple-supplied Pythons. Instead, install and use a newer version of Python from python.org or a third-party distributor that supplies or links with a newer version of Tcl/Tk.
I'm rather new to using python and haven't done really anything to configure python. my professor gave us an autograder.py file that checks our python code for correctness. the autograder.py file imports a file called grader.py which then imports something known as cgi (import cgi). inside this cgi file located at '/usr/lib/python2.7/cgi.py' there is a line of code that says
from operator import attrgetter
this is where the problem occurs. i recieve the following error
Traceback (most recent call last):
File "autograder.py", line 12, in <module>
import grading
File "/home/ggkfox/Documents/164-CSCI/1-Assignment/tutorial/grading.py", line 13, in <module>
import cgi
File "/usr/lib/python2.7/cgi.py", line 37, in <module>
from operator import attrgetter
ImportError: No module named operator
it is my understanding that the operator module should be built in (according to other stack overflow posts). this error only occurs when i use python2.7.12 (as opposed to python3.5). i have had a simular issue importing Tkinter in 2.7 aswell.
also i want to say that i have tried uninstalling python using:
sudo apt-get purge python2.7
but it wont even uninstall for me to even attempt to reinstall. im not using any pipenv or desktopenv.
i dont know what else to say, im very new to python coding.
It is almost a necessity to use a virtualenv for each python project.
A virtualenv creates a dedicated python environment and it saves you from a lot of 'operating system' related issues.
Here, you can find some virtualenv solutions compatible with all Python versions, along with the official python 3.6.4 documentation.
I am using Python 3.6 on Windows 7 and I have a problem with the igraph package. I was having errors while I was trying to install it using pip, so I decided to install it from the .whl file. Unfortunately, I couldn't find version appropriate for Python 3.6, so I downloaded another version and changed the name of the file so that it looked like it was designed for Python 3.6. The installation was successful, but when I am trying to run a script which uses the igraph module - a following error message appears:
Traceback (most recent call last):
File "C:/Users/Jarek/Documents/Studia/Programowanie/Python na studiach/Analysis of Unstructured Data/List2.py", line 6, in <module>
import igraph as ig
File "C:\Users\Jarek\AppData\Local\Programs\Python\Python36-32\lib\site-packages\igraph\__init__.py", line 34, in <module>
from igraph._igraph import *
ModuleNotFoundError: No module named 'igraph._igraph'
I haw a very similar issue under Python igraph import error on Windows
but there was no answer there. I have also seen
No module named 'igraph._igraph' but suggestion given there does not help me (or I do not know how to properly apply it).
Any help will be greatly appreciated. Thanks in advance.
I couldn't find version appropriate for Python 3.6, so I downloaded another version and changed the name of the file so that it looked like it was designed for Python 3.6.
So the trick didn't work. Use Python 2.6 or 2.7. Or compile from sources.
I have been messing around with Python/Panda3D and trying to get my first file to run. I am on OSX and after installing Panda3D I tried to run this file:
import direct.directbase.DirectStart
run()
That was followed by this on the Terminal output:
$ python core.py
Traceback (most recent call last):
File "core.py", line 2, in <module>
import direct.directbase.DirectStart
ImportError: No module named direct.directbase.DirectStart
I have been searching everywhere, but all the forms don't really solve the problem. Any help would be awesome!
Thanks!
This is usually a problem when you're using a version of Python other than the one Panda3D is compiled with. If you are using the 1.9.0 Lion build of Panda3D, make sure you are using the system-provided copy of Python 2.7, by explicitly running "python2.7" or "ppython" (which should be a symlink to the correct version of Python).