Reputation: 597
I have Python 3.6 installed with Matplotlib and I created a small program, which runs and plots the graph fine. Now, I want to export the data from this program into a MySQL database. I downloaded MySQL/Python connector, which only supports Python 3.4. So, I installed Python 3.4 as well. Now,I have two Python installed. My program runs fine if I do
python test.py
If I go into 3.4 installation directory and run the same command, it fails with the error 'No module named matplotlib'. If I do
pip install matplotlib
from 3.4 directory, then it says 'requirements already satisfied'. Any idea what am I missing here?
Upvotes: 1
Views: 1041
Reputation: 7806
You need to keep your installs separate. The path statement is getting messed up. I would suggest getting anaconda. Once you install it you can get all the packages and dependencies in one action.
conda create -n py34project python=3.4 matplotlib ipython other_package
then easily get python 3.6
conda create -n py36project python=3.6 matplotlib ipython other_package
you can use:
source activate py36project
to enter the environment (which will fix the path problem) and leave the environment with source deactivate
Upvotes: 0
Reputation: 33542
Calling pip like this, it's not about the current directory, but just about your system paths. If you want to be sure, you can always go to python-env/Scripts/pip
(your python-binary would be at python-env/python
).
Upvotes: 5