I use a Mac and haven't used Sublime Text and Python in a few months, and have come back to it for a project. But, I get an error when I try to build documents I've definitely built before, and even the simplest test document (ex. print("Hello World!")). It must be because of some Mac update, but I am not on Big Sur, I'm still on Catalina. I can't update to Big Sur to fix my problem because of my work I need certain programs that are not compatible with Big Sur yet.
I get the following error:
/Users/maxzhou/.bash_profile: line 1: export: `v6.1.1/bin': not a valid identifier
bash: /Library/Frameworks/Python.framework/Versions/2.7/bin/python: Bad CPU type in executable
[Finished in 0.0s with exit code 126]
[shell_cmd: python -u "/Users/maxzhou/Documents/Test file.py"]
[dir: /Users/maxzhou/Documents]
[path: /Library/Frameworks/Python.framework/Versions/3.8/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/local/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/Library/Frameworks/Python.framework/Versions/3.4/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/opt/X11/bin:/Applications/Racket:/Applications/Racket v6.1.1/bin]
I vaguely remember encountering this error when setting up Sublime Text for the first time, but now don't remember how to fix this.
Sorry, I met a similar error as well and my Macbook is also Catalina...
When I restart my Mac and try to run Python codes on Sublime Text 3 using "Python" system built by Sublime at the first time, everything is ok, but if I quit Sublime and then open it and run python codes then I will get some errors... e.g. if I "import bs4" then I will get an error "there is no module called bs4" but I do install this module by pip install (as well as pip3 because I install two kinds of Python in my Mac, one is Anaconda while another is Python 3.8)...
I don't know what happens but I think this might be kind of bug on Mac or Sublime maybe...
Related
I am a beginner in python. I use windows 10 and IDLE. I have cloned a code from github and there are a bunch of *.py files. when I run the main code in python IDLE there is an error:
ModuleNotFoundError: No module named 'mayavi'
I tried to install mayavi in windows cmd using "pip", but again there is a long error starting with this sentence:
ERROR: Command errored out with exit status 1:
it seems that it is a bit complicated to install mayavi.
is this package installation thing a problem in IDLE? what if I use another IDE?
In fact I am not sure that IDLE is a good choice for coding python or not? In addition I am using python 3.10.1.
I look forward to hearing your advices.
Thanks in advance
Try AnaConda. It will manage the installation of python packages in an organized way.
The main probem was VTK installation. I tried the procedure explained here:
https://www.youtube.com/watch?v=IgvbhyDh8r0&t=222s
I have been trying for quite some time now to make my Python program run on pc's that don't have python installed. I have issues because I'm using python 3.6.0. In this post I am going to discuss a method I got from this video.
The first thing I did, was install Python 3.5 and create a virtualenv for it, which I activated. You can see how I did that on the post I made earlier today. After I activated the environment, I used this command in cmd in the python 3.5 environment: pip install cx_Freeze. It got installed with no errors. Then I made this setup.py file:
from cx_Freeze import setup, Executable
setup(name='vkv',
version='0.1',
description='Berekent de wortels van een vkv',
executables = [Executable('vkv.py')])
The python file that I want to turn into a .exe file is called vkv.py. The vkv.py file and the setup.py file are both the only 2 files on this path: C:\Users\hp\Desktop\Code\Python testing\distr.
Ok so now I only have to enter setup.py build in the command line in order to make the .exe file. But when I do that, I get a bunch of lines, with an error on the last line:
AttributeError: module 'dis' has no attribute '_unpack_opargs'
Here is a screenshot of it:
Does anyone know what I did wrong? Is it something in the setup.py file, is it not setting up the virtualenv correctly? And does anyone know what this error means and how I can fix it?
You are dealing with an version of cx_freeze that has a bug that manifests itself for versions larger than 3.5.2, this issue has already been reported here and fixed.
In short, a small change was introduced in Python 3.5.2 that cx_freeze failed to catch, now a check is made to work smoothly.
In short, you'll need to update cx_freeze, you could either try pip install -U cx_freeze or get the source for it.
p.s Using Python 3.6 right now probably isn't the best idea since quite some changes were made and bugs might take a while to be caught and fixed.
Trying unsuccessfully to install pdfquery on my Win 7 machine, but running into "SyntaxError: invalid syntax"
Environment: Windows 7, Home Premium, Service Pack 1. Python 3.4.2.
I tried the steps suggested by BigBang at 30845808 , but still unable to install. Here is a screenshot of the error (running CMD shell as Admin)
All suggestions welcome as this module looks very useful (once installed ;-) )
Thanks. I'm embarasssed not to have noticed that. Got in touch w the author of pdfquery who said, "The package doesn't support Python3 right now, no -- see this bug: https://github.com/jcushman/pdfquery/issues/22
The Python2 print statement appears in the pdfminer library, which is a major dependency for pdfquery. So probably the biggest hurdle is getting pdfminer to support Python3 -- after that, updating pdfquery would be pretty easy."
I am trying to install python through cygwin on a windows machine in order to make use of a statistical program that can only be implemented using python in a linux environment.
I have run setup-x86_64.exe and installed all python related cygwin packages in an attempt to install python, but when I open a terminal and type python I just get
$ python
-bash: python: command not found
which is the same for all python commands I try so clearly the installation has not occurred. However, I have found a path to Python-2.7.9 which appears to contain the files required to build python from source.
When I run ./configure it is successful, but when I then input make it fails due to:
File "build/temp.cygwin-1.7.35-x86_64-2.7/libffi/fficonfig.py", line 33, in <module>
ffi_sources += ffi_platforms['X86_WIN64']
KeyError: 'X86_WIN64'
Makefile:488: recipe for target 'sharedmods' failed
make: *** [sharedmods] Error 1
Anyone know why make won't work?
The options in ./configure --help are unfamiliar to me, could any of these options allow for successful installation?
Any ideas would be greatly appreciated, thank you.
Cygwin comes with an installer, called setup.exe or setup-x86_64.exe. Just run it and type python to the search box. Then let it install it for you.
python language interpreter is the basic package you need.
So, this question is 3 years old, but this error still happens with most recent versions of Python 2 (tested with 2.7.13 and 2.7.15)
I was able to get python to build by modifying the following file in the build directory.
--- build/temp.cygwin-2.11.1-x86_64-2.7/libffi/fficonfig.py~ 2018-11-03 14:51:53.290000000 -0400
+++ build/temp.cygwin-2.11.1-x86_64-2.7/libffi/fficonfig.py 2018-11-03 14:53:41.793000000 -0400
## -9,6 +9,7 ##
'X86': ['src/x86/ffi.c', 'src/x86/sysv.S', 'src/x86/win32.S'],
'X86_FREEBSD': ['src/x86/ffi.c', 'src/x86/freebsd.S'],
'X86_WIN32': ['src/x86/ffi.c', 'src/x86/win32.S'],
+ 'X86_WIN64': ['src/x86/ffi.c', 'src/x86/win64.S'],
'SPARC': ['src/sparc/ffi.c', 'src/sparc/v8.S', 'src/sparc/v9.S'],
'ALPHA': ['src/alpha/ffi.c', 'src/alpha/osf.S'],
'IA64': ['src/ia64/ffi.c', 'src/ia64/unix.S'],
The source files, in particular src/x86/win64.S, are present in the source tree. For some reason, ./configure does not seem to be properly adding the option to the dictionary in the fficonfig.py file, which causes the KeyError posted in the question. After making this modification, make and make install completed successfully and I was able to install an alternate version of python in addition to the normal Cygwin package.
I'm not yet sure why this happens, but I thought I would attempt to provide a solution to the question actually asked rather than just telling the asker to install a pre-compiled version using the package manager.
Since building Python from source was said to be a bad idea, I assumed my Cygwin was broken. I attempted to uninstall Cygwin following the instructions on the Cygwin website, but I was unable to remove it due to permission difficulties (I use a university-supplied Windows machine). My last resort was to run the Cygwin installation wizard setup-x86_64.exe and uninstall all packages, then run the wizard once more and select the necessary packages again as if starting from new. Miraculously, installing the required packages from scratch solved the problem and I am now running Python through my Cygwin terminal with no errors.
If you want to run Python on Cygwin, you might need to build it from source.
download the source
unpack it to the directory you could delete later, eg: build
run Cygwin, type: cd /path/to/build
run ./configure --help and read the help about the options you'll need
./configure #options
make
I have pretty low experience with Python, but I'm tasked with creating an installation package so that I can distribute a GUI that messes with Time Series of Stocks taken from online. Based on what I've seen online, Python 3.4.1 has a built in module called ensurepip and pip, but for some reason I try and execute " python -m ensurepip" on the Python Shell, I get "Invalid Syntax"
I'm hoping to use pip to install all the dependencies for Pandas myself, but this is just one problem of many I suppose.
Edit: Slight update I suppose. I've checked my files and I know ensurepip is in the library of modules, and I've tried going through https://docs.python.org/3.4/installing/index.html and can't make heads or tails of it from my issues. Thanks in advance.
Edit2:http://puu.sh/azkqQ/4a5606a1f5.jpg
Picture indicating what I get. I've tried on the Command Prompt without the py and within the py
you're calling that command from the python shell. but it should be called from the command line. so just open up cmd or terminal and run that there, you should be fine.
and in the future, you should show the entire error. you probably got something like:
python -m ensurepip
^
SyntaxError: invalid syntax