Anaconda 安装 PSYCOPG2 on windows
来源:互联网 发布:手机淘宝收藏软件 编辑:程序博客网 时间:2024/04/29 18:39
转自http://cecilialiao.com/2015/06/08/installing-psycopg2-for-python-2-7-on-windows-x64/
ATTEMPT 1: CONDA INSTALL PSYCOPG2
Because I was using the Anaconda build of Python, I always give this command line a try (rightly or wrong!). If Continuum, the folks who bring us Anaconda, has the library on their repository, why look anywhere else?C:\cecilia.liao> conda install psycopg2
Unfortunately, this didn’t work.
ATTEMPT 2: PIP INSTALL PSYCOPG2
I’ve found that using a python package manager is usually the easiest way to install third party libraries.
C:\cecilia.liao> pip install psycopg2
Unfortunately, the installation failed and mentioned something about requiring python-dev and libpq-dev. Trying to install these two libraries via pip was not the quick solution I had hoped for, and the impatient me couldn’t find much details about these two libraries that didn’t mention Linux.
Time to change tack.
ATTEMPT 3: INSTALL VIA EXE
The maker of psycopg2 refers to a Windows port kindly provided by another developer. Bingo, exe files. Double click and away I go!
Correct version downloaded, installation finished, but why won’t psycopg2 import!?
Windows -> Control Panel -> Programs and Features -> Python 2.7 psycopg2 -> Uninstall
ATTEMPT 4: INSTALL VIA GIT HUB
Before opening another can of search worms, I noticed that the chap who provided the exe files mentioned yet another developer who has provided pip packages of psycopg2 for Windows. I suddenly felt reassured that I can’t be the only one struggling with this same problem.
C:\cecilia.liao> pip install git+https://github.com/nwcell/psycopg2-windows.git@win64-py27#egg=psycopg2
Voila, installation successful. Quickly opened an instance of python and import psycopg2 didn’t generate an error message. Fantastic! Time to go back to Spyder 2 to finish my work.
C:\cecilia.liao> python
>>> import psycopg2
ImportError: No module named psycopg2
What?! Turns out, despite working in the plain vanilla version of Python, the library wasn’t installed in the Anaconda build of Python. I double checked %PATH% environment variable which didn’t provide an immediately obvious answer. Is it time to give up and use a completely different driver?!
Back to command prompt:C:\cecilia.liao> pip uninstall git+https://github.com/nwcell/psycopg2-windows.git@win64-py27#egg=psycopg2
ATTEMPT 5: EASY INSTALL OF EXE
In the half hour (maybe more…) I spent investigating this, I remembered skimming through a mention of easy install. Last ditch effort… I used command prompt to navigate to the folder where the exe (from step 2) was saved.
此处的easy_install 应该用anaconda下script文件夹中的easy_install,即在cmd下进入该文件夹,再执行。然后,后面的exe应该用全路径。
PS. 此处的psycopg2的版本号需要与anaconda的版本号对应,即要么都是32位,要么都是64位。
C:\cecilia.liao\downloads> easy_install psycopg2-2.6.0.win-amd64-py2.7-pg9.4.1-release.exe
Installation was successful but by now I was sceptical if I would ever get this library to play ball.
这里的ipython如果没有在path中定义过的话,还是进入到anaconda下的目录,然后直接执行python即可。
C:\cecilia.liao\> ipython #opens Anaconda build of Python
>>> import psycopg2 #not going to hold my breath
>>>
Huh, what? No error message? Oh, it worked…. it worked!
- Anaconda 安装 PSYCOPG2 on windows
- anaconda 通过pip 安装python psycopg2
- windows下采用mingw编译安装psycopg2
- Install Tensorflow on windows(Anaconda)
- windows上安装Anaconda
- Windows Anaconda Tensorflow 安装
- Windows安装anaconda
- Windows+anaconda+labelme安装
- windows Anaconda lightgbm 安装
- Windows下安装 XGBoost (Installing XGBoost For Anaconda on Windows)
- windows环境下python安装psycopg2后import报错
- Installing Xgboost for Anaconda on Windows
- Windows Tensorflow Anaconda安装配置
- windows anaconda下安装xgboost
- windows 下 Anaconda 安装 TensorFlow
- windows 下 Anaconda 安装 TensorFlow
- Ubuntu安装psycopg2小记
- Mac OS安装psycopg2
- ArrayList详解
- CLLocationManager的相关属性讲解
- HiWork发布1.5.0新版本——集成第三方应用达到44种
- MyBatis简介与配置MyBatis+Spring+MySql
- 端口被占用
- Anaconda 安装 PSYCOPG2 on windows
- POJ 2367 -- Genealogical tree【拓扑排序 && 水题】
- 桥接模式(Bridge)
- 电驴资源下载
- 死锁产生的原因和解决办法
- Loadrunner11.0 录制手机App脚本的方法
- gridview里面的按钮绑定值,并且点击传回到后台
- Hibernate入门简介----张冬
- 栈和队列应用之括号匹配