Trouble using py2exe - python-2.7

When i write this command in CMD
python.exe C:\Users\osman\Desktop\setup.py c:\py2exe
Then it says that unable to import py2exe.
I don't understand what to do now.
please help.

I guess you are running on Windows since you are using python.exe.
First, make sure you installed python correctly, including configure the system path. Then in CMD you should be able to type 'python' and run directly.
Then make sure you installed py2exe correctly.
When you install, it will find your python path automatically.
So if you have the question "Where exactly should I put it in", it probably means you didn't install it correctly.
After finish installing, you can run the command:
python C:\Users\osman\Desktop\setup.py py2exe

Related

Failing to install sqlite3 plugin for electron project on windows

I am trying to include sqlite3 in an electron project I am getting my hands dirty with. I have never used electron, nor Node before, excuse my ignorance. I understand that to do this on Windows, I need Python installed, I need to download sqlite3, and I need to install it.
As per the NPM sqlite3 page, I am trying to install it using npm install --build-from-source
It always fails with
unpack_sqlite_dep
'python' is not recognized as an internal or external command,
operable program or batch file.
I have Python 2.7 installed and the path has been added to environment variable PATH. I can verify that if I type 'python' in cmd, I get the same response. BUT, if I type 'py', it works....
So, my question is: how can I make node-gyp use the 'py' command instead of 'python' when trying to unpack sqlite3?
If this is not possible, how can I make 'python' an acceptable command to use?
I am using Windows 10 if this helps. Also, please let me know if I can do this whole procedure in a different way.
Thanks for any help!
This has been resolved....
Uninstalled Python 2.7.13. Reinstalled, added path to PATH variable again, now command 'python' works just fine...

Global name 'col2im_6d_cython' is not defined, CS231n

I'm following CS231n and met a problem when doing assignment2: ConvolutionalNetworks: global name 'col2im_6d_cython' is not defined.
I think the problem was due to a failure in importing functions from im2col_cython.pyx, which used cython.
I've installed Xcode 7.3.1, as shown below, but the problem was still not solved.
I'm running the ipynb files in Jupyter from Anaconda. There is a related discussion on reddit, but unfortunately the solution here was for Windows, not Mac OS X.
Thank you for your time.
I wanted to add my input as a comment but didn't have enough reputation points to do so.
The issue was resolved for me when I closed the jupyter notebook and opened it again. I compiled the cython extension after I got the import error and probably have to relaunch it when the .so file is available.
I solved this with 2 easy steps:
In the terminal, run python setup.py build_ext --inplace in the cs231n directory.
Then reopen the notebook (if necessary, shutdown the notebook, the open it again);
Ps.: I tried this through the notebook using !python ./cs231n/setup.py build_ext --inplace as well. It does not work! You have to that outside the notebook, using the terminal.
I had this problem recently. I googled it a lot and also tried un-/-reinstall Anaconda. However it does work further. So I used "which python" to figure out which python's been using. And it turns out that the python included in Anakonda directory is used as default. I then tried the python2.7 in my macOS, which is located in /usr/bin/python2.7. Although I got a couple of warnings, but now it works likes charm. Perhaps it's kind of version problem. Solved in macOS Sierra 10.12.4.
I compared the two compiling results, as it shows that the include files are totally different. The one in Anaconda includes all header files in python3.6. Instead we need here corresponding header files in python2.7(I suppose). As the red circles point out.
enter image description here
Supported by python 3 onwards. Go to setup_googlecloud.sh and change the line
virtualenv .env
to
virtualenv -p python3 .env and run the setup again as explained in assignment1 setup..
Works well after that..
It occurred to me as well.
My problem:
I saw that the extention file that is created is named "im2col_cython.cp37-win_amd64.pyd" and the import is looking for im2col_cython alone, so I changed the file name to "im2col_cython.pyd" and ran the setup script again.
Now when I ran the code in the notebook it found the module but it said that the dll was compiled with a different python version. I use Anaconda envs and it turns out that since I ran the setup script from the cmd, it used a different python version than the one of the environment. I deleted the created files from the cs231n directory (im2col_cython.cp37-win_amd64.pyd and im2col_cython.c) and ran the setup script again, this time from the env Anaconda Prompt and it worked.
Solution:
remove already created files (the .c and .pyd files)
run the setup
script from the environment prompt (not plain cmd)
change the .pyd
file name into im2col_cython.pyd
Enjoy!

Python site-packages and corresponding interpreter

I used brew to install python 2.7 and 3.5 on Mac. SOMEHOW I have this site-packages directory /usr/local/lib/python2.7/site-packages.
But every python interpreter on the system points to every other site-packages directory EXCEPT this one. How do I use THIS site-packages directory?
(This is all because I need Vips. I'd installed this before, but now I'm using a different machine and I can't figure out how on Earth I got it to work before.)
The vips docs have a checklist and an explanation of what happens when Python tried to import vips:
http://www.vips.ecs.soton.ac.uk/supported/current/doc/html/libvips/using-from-python.html
But briefly you need to:
You have several Pythons installed, make sure you are invoking the brew one.
Make sure that that Python has a gi repository containing the Vips.py overrides.
Make sure you have a Vips-8.0.typelib file in /usr/local/lib/lib/girepository-1.0/.
SOLVED.
I didn't want to have to resort to resetting my dev box to factory settings, but I did. I hope this helps somebody...
If Python already exists on your system, and you're planning on installing Python yourself or with Homebrew (because you only get python2.7 out of the box), make sure you install the new Python first. Then put the install location first in your PATH. Then install your modules. In that order. I knew something was wrong, so I uninstalled Python/3 and Vips. But when I reinstalled them, for whatever reason Vips still didn't know to bind itself to the Python in /usr/local/Cellar. Even though I had /usr/local/Cellar first in PATH.
So to recap -- first install Homebrew, then set the PATH, then install python/python3, and finally install Vips. And you're good to go.

Installing Selenium on Python

i am trying to install Selenium on my computer.
I downloaded Python and as far as i know PiP is already installed, but when i write in my command prompt "pip" , nothing happends, it just sits there and does nothing and i can't write in the console anymore, like its loading.
If i write Python in the console there comes up version and commands work as they should in the Python Client.
I do add the right paths and i double check alot of times.
Anyone had this problem? tried pretty much every solution out there.

Installing anaconda to use with windows

I am lost in the installation process of installing anaconda on windows.
I've installed the windows 32bit package (I'm running windows 7 x64)
I have anaconda in the start menu and I can open the python console and use scipy.stats.t.interval(), the function I am interested in.
However, how do I go about including this in another python program? I think it's something like adding it to the path. For instance, I have the scipy.stats.t.interval() function call in my other python file which I run through cygwin via python myscript.py. However it returns the error:
from scipy.stats import t
ImportError: No module named scipy.stats
I think it might be a change of path / add to path issue, but I'm not sure how to fix it :/. While I try to fix it, I figure I will post for help here.
well you might have two installations of python, one inside the anaconda package, and other which you might have installed earlier. try doing :
which python
from CygWin console.
If it returns:
/usr/bin
then it is definitely a add-to-path problem.
to fix it for CygWin,
you have to add the python installation from anaconda to the path.
try this fromn CygWin:
PATH=path-where-anaconda-is-installed/anaconda/bin:$PATH
and then doing:
which python
should give you:
/path-to-anaconda/anaconda/bin
and then it will work.
Cheers