This question already has answers here:
python3 --version shows "NameError: name 'python3' is not defined"
(2 answers)
Closed 6 years ago.
I'm sure I'm missing something obvious, so I apologize in advance. Here's the situation:
I'm trying to install some python modules to work with excel documents, however, I can't even get the easy_install command to work. Both python and python\scripts are in my system path, and I've run the setup tools script several times. I've checked the scripts folder, and it contains both the easy_install script and the .exe file. However, when I try to run it from the command line, I receive a traceback error:
>>> easy_install
Traceback (most recent call last):
File "", line 1, in
easy_install
NameError: name 'easy_install' is not defined`
this is a 64-bit Windows 8 machine.
What am I missing here?
easy_install is a shell command .
To use easy_install on windows follow these steps:
press window + r and type cmd then press Enter
probably easy_install.exe is not in your system path, so type the full path to easy_install:
C:\Python27\Scripts\easy_install.exe name_of_the_package then press Enter.
I suggest you to read this: http://pythonhosted.org/distribute/easy_install.html#windows-notes
Related
I am attempting to install PyMC using pip install pymc. I believe this command should install PyMC 2.3.6.
PyMC has a few dependencies, which I have in my PATH. I am running OSX 10.11.2 and my PATH includes Python 2.7.13, NumPy 1.12.0, Matplotlib 2.0.0, gcc, and gfortran.
Python (including pip) was installed using Homebrew. NumPy and Matplotlib were installed using pip. The gfortran compiler was downloaded and installed from the GCC Wiki for the purpose of this installation.
Executing pip install pymc yielded lots of output including the following lines.
Collecting pymc
Using cached pymc-2.3.6.tar.gz
Complete output from command python setup.py egg_info:
running egg_info
running build_src
build_src
building extension "pymc.flib" sources
f2py options: ['skip:ppnd7']
f2py:> build/src.macosx-10.11-x86_64-2.7/pymc/flibmodule.c
creating build
creating build/src.macosx-10.11-x86_64-2.7
creating build/src.macosx-10.11-x86_64-2.7/pymc
IOError: [Errno 2] No such file or directory: 'skip:ppnd7'. Skipping file "skip:ppnd7".
updatevars:gradlike: attempt to change 'dimension(nx)' to 'dimension(na)'. Ignoring.
updatevars:gradlike: attempt to change 'dimension(nx)' to 'dimension(nb)'. Ignoring.
updatevars:gradlike: attempt to change 'dimension (nmu)' to 'dimension(nmu)'. Ignoring.
updatevars:gradlike: attempt to change 'dimension (na)' to 'dimension(na)'. Ignoring.
rmbadname1: Replacing "index" with "index_bn".
Reading fortran codes...
Reading file 'pymc/flib.f' (format:fix,strict)
Line #34 in pymc/flib.f:" PARAMETER (infinity = 1.7976931348623157d308)"
get_parameters: got "unexpected EOF while parsing (<string>, line 0)" on ''
...
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/2f/cr97n5v93mn04c3qbqd7r3q40000gn/T/pip-build-6Zmgcz/pymc/setup.py", line 124, in <module>
**(config_dict))
File "/usr/local/lib/python2.7/site-packages/numpy/distutils/core.py", line 169, in setup
return old_setup(**new_attr)
...
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/2f/cr97n5v93mn04c3qbqd7r3q40000gn/T/pip-build-6Zmgcz/pymc/
As suggested in these two pip installation threads about egg_info errors [1, 2], I ran pip install —upgrade setuptools and pip install ez_setup. Once these items were installed I ran into the same types of errors pasted above.
As noted in other package installation threads, I am willing to use conda to install PyMC if I cannot resolve these issues. However, I'd like to investigate this installation issue first.
Would anyone happen to know what my issue is here? Might there be some steps I can take to successfully install PyMC using pip?
I had the same problem. I don't understand the root cause, but I fixed it by downgrading numpy to version 1.10.1: pip install numpy==1.10.1
I also met this problem while trying to install pymc from pip or source code, but I found a solution that might be useful.
The reason that causes the problem might be the file setup.py, in which the script check the compile env. I didn't read the code very carefully, but in the function build_ext() I think the codes first check whether some compile environments have already been installed into OS. If installed, the script will use them as defaults; if not, use ones in somewhere else (the comment says 'from netlib sources').
I infer the problem is caused by the compile environments that have already been installed in the OS, so I modify the file setup.py to skip this part of codes, and let the script use the netlib source. Then I run sudo python setup.py install. There are some error and warning messages, but the folder 'pymc' emerges in python library, and some simple test codes run successfully.
I'm trying to get a django site up on bluehost. I already have one running using python2.7, but for this new project I am using python3.5. I've pretty much tried to set everything up the same way that I did before, except using python3. When trying to install flup:
pip3 install flup
but I am getting an error:
Collecting flup
Using cached flup-1.0.2.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 20, in <module>
File "/var/tmp/pip-build-mzc6swh8/flup/setup.py", line 2, in <module>
from ez_setup import use_setuptools
File "/var/tmp/pip-build-mzc6swh8/flup/ez_setup.py", line 98
except pkg_resources.VersionConflict, e:
^
SyntaxError: invalid syntax
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /var/tmp/pip-build-mzc6swh8/flup
I am guessing that this instance is flup is seeing my python2 version of flup or something and throwing an error. Any ideas on how to solve this?
Also, I've seen this, but that's not the issue I am having.
The answer is here:
https://stackoverflow.com/a/27703117/1378264
(install flup6 instead flup because flup does not work with python3)
Use flipflop instead
pip3 install --upgrade flipflop
flipflop is what did the trick for me.
flup-py3 has an unresolved issue which has been standing open for a couple of years now.
Do not forget to edit the import line in your .fcgi script to reflect this change towards using flipflop.
Trying to install uwsgi according to documentation. I'm getting the below error on Windows 7.
What should I do?
(uwsgi-tutorial) C:\Users\Home\Videos\uwsgi-tutorial\mysite>pip install uwsgi
Collecting uwsgi
Using cached uwsgi-2.0.11.1.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 20, in <module>
File "c:\users\home\appdata\local\temp\pip-build-04g1m6\uwsgi\setup.py", line 3, in <module>
import uwsgiconfig as uc
File "uwsgiconfig.py", line 8, in <module>
uwsgi_os = os.uname()[0]
AttributeError: 'module' object has no attribute 'uname'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in c:\users\home\appdata\local\temp\pip-build-04g1m6\uwsgi
uWSGI can be compiled on Windows only using cygwin. There is no such thing as uname in normal Windows console, but it exists inside cygwin. If you're already in cygwin console, try to run uname command, if that exists, check if os.uname() in python inside cygwin is also working.
Latest news from the front, uWSGI perfectly works on Windows 10 in bash on Ubuntu on Windows
As Linux subsystem still in beta, i'd not recommend for production usage, however this will cover all dev needs.
P.S. i know that op ask about Windows 7, however as Windows 10 and Linux subsystem come to Windows world later, i think i can leave this here.
uWSGI can be compiled on Windows using Cygwin. But unfortunately, I was getting the same message with the Cygwin.
Here I am sharing the other way to install uWSGI on windows.
Step 1: Download the stable release and extract the tar file
Step 2: Open uwsgiconfig.py and import platform then replace os.uname()[index] with platform.uname()[index]
Change
uwsgi_os = os.uname()[0]
uwsgi_os_k = re.split('[-+_]', os.uname()[2])[0]
uwsgi_os_v = os.uname()[3]
uwsgi_cpu = os.uname()[4]
To
import platform
uwsgi_os = platform.uname()[0]
uwsgi_os_k = re.split('[-+_]', platform.uname()[2])[0]
uwsgi_os_v = platform.uname()[3]
uwsgi_cpu = platform.uname()[4]
Step 3: Run python setup.py install
Note: You may need to install GCC and configure it.
I have downloaded the Reindent-0.1.0 and trying to use this for automated indention purpose.
I don't know how to install and run these commands and while I am trying to use this command
I am getting following error
command:
C:\Python26\Scripts\Reindent-0.1.0>Python setup.py
C:\Python26\Scripts\Reindent-0.1.0>Pyth
Traceback (most recent call last):
File "setup.py", line 5, in <module>
from setuptools import setup
ImportError: No module named setuptools
I don't understand the setuptools, where it is and how to put inside
please note my folder files in Reindent-0.1.0
Reindent.egg-info
PKG-INFO
README
reindent
setup.cfg
setup.py
Also how can I run the commands for reindent, for an example, once after I installed the reindent, if I want to
run dryrun command how I should write?
If I write like this, will it be correct ???
C:\ProjFolder\ApplicationDevelopment\GUI>reindent -d Test.py
some realtime example of "-d (--dryrun) Dry run and -r (--recurse) Recurse" will be helpful!!
and where I should target the command file path, in dos
to my application running directory or C:\Python26\Scripts\Reindent-0.1.0 ?? OR Application development folder??
If you get the error "no module X" when you try to run some code, that code has a dependency on module X. When you run setup.py and it says there is no module named "setuptools", it is telling you that setup.py requires the module "setuptools". Since you don't have "setuptools" installed on your machine, you get the error.
The fix is simple: install the setuptools module. Here's one of several places on the internet that shows you how to install setuptools: https://pythonhosted.org/an_example_pypi_project/setuptools.html
I am new to python, just got the learning python book and got stuck with the spam.py in the command line. The book says to make a file named spam.py and then ask python to run this by typing
%python spam.py
I have added the python to my PATH as it was C:\Python27 so I can call Python in the Windows CMD, but this just will not run. The error I receive is
>>>python spam.py
File "<stdin>", line 1
python spam.py
^
SyntaxError: invalid syntax
I appreciate any help that you can give.
Your problem is that you're trying to run your code from within the Python interpreter itself (the >>> prompt is the giveaway here since that's the Python prompt).
Exit from the interpreter (with CTRL-Z and ENTER for Windows) and run it from cmd.exe (the c:\> is the prompt in the example below):
c:\> python spam.py
From within the interpreter, you can also run an external file with:
execfile('spam.py')
Could you post the code from spam.py...
You seem to be trying to run the spam.py from the Python interpreter. Go to where the file is in Windows Explorer and launch it from there, using the C:\Python2.7\python.exe CLI.
By the way, since you didn't understand the syntax error warning, please see:
http://dictionary.reference.com/browse/SYNTAX
http://dictionary.reference.com/browse/SEMANTICS
You are trying to execute Python script file within the interpreter. Come out from the Python interpreter by pressing CTRL+Z and then ENTER key.
Then execute with the command :
Say, C:/> python spam.py
In order to run a python program you have to run program in Command Line not in Python Interpreter (press Windows Sign + R and type cmd.exe)
Moreover you have to remember to be exactly in the directory where your file is saved, e.g.:
If the file file is C:\Python27\spam.py you have to be in C:\Python27.
To change the directory:
use dir to display the folders and files in current place
use cd to change your directory (e.g. C:\Python27\>cd Spam moves you to C:\Python27\Spam
use Tab key to autocomplete names of the commands, folders and files
As you said you have added Python to PATH and followed my instructions, the statement below should work perfectly
python spam.py
Hope I could help.
If for example, your file is in G: drive, type this in cmd:
python G:/myfile.py
Basically, type in the path. Just doing "cd" won't work in Python