1

I want to access python 2.7 modules in python 3.4 .I did the following but in python 2.7 it works but it is not working with python 3.4

Python 2.7 works:

xxx@xxx-Dell-System-XPS-L502X:~$ python
Python 2.7.6 (default, Mar 22 2014, 22:59:56) 
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import nltk
>>> 

Python 3.4 fails:

xxx@xxxx-Dell-System-XPS-L502X:~$ python3
Python 3.4.1 (default, Feb 27 2015, 14:48:48) 
[GCC 4.8.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import nltk
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named 'nltk'
>>> 

Is there any solution for this?

1
  • You probably have nltk installed (via pip?) for Python 2.7, but not for Python 3.0. If so, then you can try to install it again for Python 3.0: stackoverflow.com/questions/11268501/… Commented Apr 10, 2015 at 8:00

2 Answers 2

1

This happens to me on occasion when I install using pip and not pip3.

Try:

pip3 install nltk
Sign up to request clarification or add additional context in comments.

Comments

0

You probably have nltk installed (via pip?) for Python 2.7, but not for Python 3.0. If so, then you can try to install it again for Python 3.0:

How to use pip with Python 3.x alongside Python 2.x

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.