I'm trying to install the module mySQLdb on a windows vista 64 (amd) machine.
I've installed python on a different folder other than suggested by Python installer.
When I try to install the .exe mySQLdb installer, it can't find python 2.5 and it halts the installation.
Is there anyway to supply the installer with the correct python location (even thou the registry and path are right)?
did you use an egg?
if so, python might not be able to find it.
import os,sys
os.environ['PYTHON_EGG_CACHE'] = 'C:/temp'
sys.path.append('C:/path/to/MySQLdb.egg')
Related
I'm installing a package (cx_Oracle), and the documentation says:
Make sure you are not using the bundled Python. This has restricted
entitlements and will fail to load Oracle client libraries.
I'm wondering: how do I tell if my Python installation (if I did not install it) is "bundled" or not?
Normally in MAC OS python comes along with installation of OS itself that means python package included in OS files also called as bundled python. You can check if the python you are using is bundled or not by
which python
On mac os
you should get output like if it's a bundled python
/usr/bin/python
when you want to get the path of externally installed python by
which python3
The only difference is
When you type
python
in terminal it launches pre-installed or bundled python.
If you type
python3
in terminal it launches externally installed python in this cases what the oracle documentation is recommended
I'm using software that is built for Windows with no version for Linux. They have dedicated Python library called ArcPy, that has scripts of all of the tools available in this software.
On Ubuntu 16.04 I'm trying to import this package to my Python, so I can use all those scripts. Inside /usr/local/lib/python2.7/site-packages I created Desktop.pth into which I echoed:
/media/adam/somedisk/Program\ Files\ \(x86\)/ArcGIS/Desktop10.5/bin
/media/adam/somedisk/Program\ Files\ \(x86\)/ArcGIS/Desktop10.5/arcpy
/media/adam/somedisk/Program\ Files\ \(x86\)/ArcGIS/Desktop10.5/ArcToolBox/Scripts
Now entering Python shell and typing import arcpy returns ImportError: No module named arcpy. I know I typed the paths with correct escaping, because I can cd them.
Is it a correct way of importing Python packages across OSs? What went wrong here?
You can not use arcpy unless, either ArcGIS Server or ArcGIS engine is installed in the machine. ArcPy does not work without the binaries.
I, as it will soon be obvious, am a total newb when it comes to Python.
I am running python version 3.5 on Windows 10, 64 bit.
I installed the PyAutoGui module for a small project I am working on. At first, everything worked perfectly. But now it appears that PyAutoGui is crashing when it clicks. I suspect that it's because PyAutoGui is only intended for use up to Python 3.4.
In order to rectify this, I downloaded Python 3.4. Unfortunately, however, when I try to install PyAutoGui (using pip install pyautogui), it tells me that it's already been installed because it sees it in the Python 3.5 folder.
My question is this: How do I install PyAutoGui in Python 3.4 with it already installed in Python 3.5?
Assume that I know virtually nothing about how to install a module manually without using pip
Thanks in advance!
If you have multiple versions of Python installed you need to find your versions and rename them and their Pips.
In windows the path is, C:\\Users\USERNAME\AppData\Local\Programs\Python\Python3x-32. The x should be replaced with the Python version and USERNAME with your username. On Mac it's located in /usr/local/bin/python. On Linux it should be in /usr/bin/python. The location might vary depending on OS and Python version.
Rename the files python.exe/python and pip.exe/pip so that each file is different. I named mine python35.exe, python2.exe and python.exe(for 3.5, 2.7 and 3.6).
Now when you execute your pip command use, pip34 install pyautogui or whatever you named the file.
Or if you really want to you can go the painful way of renaming all the path variables, but I won't explain that here.
I installed Python 3.5.1 from www.python.org. Everything works great. Except that you can't install pandas using pip (it needs visualstudio to compile, which I don't have). So I installed Anaconda (www.continuum.io/downloads). Now I can see pandas as part of the list of installed modules, but when I run python programs I still get:
ImportError: No module named 'pandas'
How do I set up my environment to use the modules from Anaconda?
Note: I have Anaconda's home directory and Library/bin on my path, as well as Python's home directory. I do not have PYTHONPATH or PYTHONHOME set, and I know I have the correct privileges to see everything.
I have successfully installed pandas for a Windows 32 bit version Python 3.4 with pre-complied code (no Visual Studio required) using the website:
http://www.lfd.uci.edu/~gohlke/pythonlibs/#pyyaml
There is link for Python 3.5 pre-complied code at this site as well, but I have not tested it.
Download the code you want to a directory on your machine.
Using your Windows CMD.exe, go to your python directory and enter:
Python -w pip install "YourDirectory/pandas-0.18.1-cp35-cp35m-win32.whl"
OR
Python -w pip install "YourDirectory/pandas-0.18.1-cp35-cp35m-win_amd64.whl
Choose the version based on the version of Python you have
have, 32 bit or 64 bit.
Good Luck!
Anaconda has included one version of Python with it. You have to change your system environment path with Anaconda's instead of the former one to avoid conflict. Also, if you want to make the whole process easy, it is recommended to use PyCharm, and it will ask you to choose the Python interpreter you want.
I am fairly new to Python and trying to install the Pillow package on Windows 7. I downloaded and ran the MS Windows installer Pillow-2.2.1.win-amd64-py3.3.exe from here. It appeared to install fine. If I run the simple line of code:
from PIL import Image
directly from the Python interpreter, it runs fine. A help() on PIL gives me the package contents.
But when I try to run the same line of code from within a script, I get an ImportError: No module named PIL. What am I missing?
(Note that I've been able to import sys and import MySQLdb from within scripts just fine.)
Resolved: sure, enough, I'm running Python 2.7 when I run scripts. (I think I vaguely recall having to install an older version so I could interface with MySQL.) Thank you all for pointing out that I should check the version being used.
For third-party modules for Windows, my go-to resource is Christoph Gohlke's Python Extension Packages for Windows. You can find the latest version of Pillow here. Make sure you're working with the python.org version of Python.
As far as your specific error, it's hard to tell exactly without a traceback, but make sure your script is calling the correct version of Python. If you have also installed Python 2.7, for example, your script may be calling that instead of 3.3.
In such cases I'm simply printing the sys.path at the beginning of the script in trouble and comparing it with the one from the working python interpreter. In most cases I was running the script with a different python interpreter.
In my case , I was referring to wrong pip folder.
Changed virtual environment in pycharm to point to right pip folder to solve this issue
import sys
print ( sys.path )