I use pip install -U nltk to install it.
After pip list I can get nltk (3.0.0).
Also sys.path includes location of nltk.
But when run import nltk, it shows ImportError: No module named nltk
I use OSX Yosemite, python2.7
I cannot figure out why it happen.
Thank you for any suggestion.
You might want to try the free Anaconda distribution of Python instead. NLTK comes pre-installed in Anaconda, along with many other popular packages for data analysis, etc. It's a lot easier than having to install & manage hundreds of separate packages individually.
https://store.continuum.io/cshop/anaconda/
Related
I am using a virtualenv on a Linux machine. I don' have sudo access so I can use pip only.
I tried:
pip install python-tk
But this resulted in this error message
Collecting python-tk
Could not find a version that satisfies the requirement python-tk (from versions: )
No matching distribution found for python-tk
How can I install Tkinter in virtualenv on Linux?
You can't install tkinter using pip because tkinter is an interface to a C++ library called Tk, whereas pip is coded with Python.
Luckily you do not have to worry about the above statement because tkinter comes as a built-in library for the standard Python distribution.
So what you have to do is:
Go to your virtualenv directory: cd to_your_virtualenv_directory
Activate it: source bin/activate
Access your python shell within it: python
Then import tkinter as tk
Note:
Depending on your settings, maybe when you type python you will notice you are prompted to work with Python 2.x instead. In that case, just type this: import Tkinter as Tk. If, however, typing python leads you to use Python 3.x (as I set it on my machine), but you prefer to work with Python 2.x then simply type python2 instead of python.
Currently, I am facing difficulty installing difflib module in python 2.7 version in windows 10 system.
I want it to perform some text analytics analysis
tried using
apt-get install npm
npm install difflib
and
pip.exe install difflib
Solution for me was to save the difflib.py in the location where your .py file resides and then import it in your file.
install using pip should be a great idea, You can refer to the module related details here:
https://docs.python.org/2.7/library/difflib.html
If you face an issue installing it using pip, then the next way is to get the difflib.py from any working machine and keep it in the project directory itself, so that just importing the module itself will work.
This is the codebase reference from svn of python itself:
https://svn.python.org/projects/python/trunk/Lib/difflib.py
I am not able to install scipy on my machine with python 2.7
pip install scipy
It always comes up with the following error
numpy.distutils.system_info.NotFoundError: no lapack/blas resources found
Just as the message says, You need functioning blas/lapack, which you need to install separately. How to do that depends on the operating system you're on.
I am doing some Python 2.7 development work on multiple computers, on some of which I do not have rights to install software. Thus, I am using Portable Python. One of the packages I need to use is h5py; however, since Portable Python installs without modifying the registry, the h5py installer doesn't see it as a valid Python installation. Also, simply extracting the h5py source to a custom F:\py\include folder and adding F:\py\include to the PYTHONPATH environment variable doesn't work, as import h5py results in an ImportError: Cannot import name _errors exception.
How do I install h5py with Portable Python 2.7?
Install Python 2.7 onto a computer for which you have sufficient administrative rights.
Install the appropriate version of h5py into this Python installation.
Find the h5py subfolder within the Python install (typically .\Lib\site-packages\h5py) and copy it to the F:\py\include folder mentioned (make sure to add F:\py\include to PYTHONPATH). See my answer here for more details.
Uninstall the 'official' version of Python, if desired.
OSX 10.10.2, Python 2.7.9, Kivy 1.9
I used sudo pip install Pillow to install Pillow when i get the not found error. I can find PIL in python help('modules') but not in kivy help('modules')
I tried Kivy user group but got no reply yet. Thank you in advance!
Kivy 1.9 package uses it's own Virtual Environment. You have to make sure to install modules into that. Simply do::
kivy -m pip install pillow
Probably kivy is looking for the Pillow package in the wrong place.
You should check where your library is installed and use that path.
The path should be something like "/Library/Python/2.7/site-packages/", look if you have the PIL package in that position.
Then set the PYTHONPATH variable or use
import sys
sys.path.append('path_to_the_PILLOW_package')
and look if "import PIL" raises an ImportError.